contracts.ruby
contracts.ruby copied to clipboard
Contracts for Ruby.
Hey all, I don't use Ruby much these days, and so I haven't been spending much time on this project. I am hoping there is someone who would be willing...
``` ContractError: It looks like you are trying to use pattern-matching, but multiple definitions for function '' have the same contract for input parameters: None => String None => String...
We found this library as a dependency of another library (snowplow/snowplow-ruby-tracker) that we use in our application. Unfortunately, we _also_ have our own top-level class called `Contract`, which basically means...
## Example code: ``` Class A include Contracts::Core include Contracts::Builtin Contract Integer, Integer => String def self.hello return "Hello world!" end end puts A.hello ``` ## Actual behavior No errors...
First thanks for developing great library, but I would like to propose enhancement. When testing this gem for complex params hashes I found that `ParamContractError` is almost unreadable. I mean...
When running `ruby -w -e 'require "contracts"; class Foo; include Contracts; end'` or `ruby -w -e 'require "contracts"; class Foo; include Contracts::Core; end'` I get this warnings ``` /home/tiago/.gem/ruby/2.4.3/gems/contracts-0.16.0/lib/contracts/core.rb:21: warning:...
This is a pretty common use case (for me at least). I define a base class: ``` ruby class Base # ... Contract String => String def foo(arg) # ......
`1 - 1` is not a positive natural number
When debugging code, I need to go trough all the Contracts code when stepping into a method guarded by a Contract. Example: ``` # ruby -rdebug /home/user/mycode/app.rb [...] /home/user/mycode/app.rb:2:method_a() (rdb:1)...
Default values and blocks don't mix well. The specs added here show this. I have added specs for both `nil default values` and `non-nil default values` because they fail differently...