|
|
|
|
|
by nahiluhmot
4085 days ago
|
|
Really cool idea! I like that you can specify a `#respond_to?` constraint instead of a class. Not sure if OP is the author, but here's some feedback: * It would be better if this didn't pollute the global namespace by defining `#typesig` in `Module` [0] -- perhaps consider refactoring that method into a module which the user may extend. Doing so would also get you out of needing to define `Module#prepend` for older versions of Ruby. * Perhaps allow the user to enable/disable type checking at a global/class level. For example, then users could only enable type checking during specs if they wanted. * Instead of using class-level variables, try using class level instance variables. They have less odd behavior when dealing with subclasses [1]. [0] https://github.com/gogotanaka/Rubype/blob/develop/lib/rubype... [1] http://www.sitepoint.com/class-variables-a-ruby-gotcha/ Edit: Whitespace |
|
also, the global switch is simple:
:)