sig: Another type checking gem for Ruby
The sig gem simplifies checking for proper “types” of method arguments and results. This is not static typing, but convenience when you need to ensure a specific object behavior.
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
The sig gem simplifies checking for proper “types” of method arguments and results. This is not static typing, but convenience when you need to ensure a specific object behavior.
Comments
I would recommend you to try to make it a decorator (instead of having the method as a param of #sig).
Here’s an example, wycats decorators
You can also check Contracts
This is super awesome. I had no idea you could pass method declarations as arguments in that way :/
I made something a while back that could be another alternative:
https://github.com/mikeyhogarth/duckpond
This doesn’t actually check the type, it checks the “properties” of the subject.
Post a comment