Module | Contract::Check |
In: |
lib/contract/integration.rb
|
Implements checks that can for example be used in Module#signature specifications. They are implemented simply by overriding the === case equality operator. They can also be nested like this:
# Matches something that is an Enumerable and that responds to # either :to_ary or :to_a. signature :x, Contract::Check::All[ Enumerable, Contract::Check::Any[ Contract::Check::Quack[:to_a], Contract::Check::Quack[:to_ary] ] ]
And | = | All unless defined?(And) | Alias for Contract::Check::All | |
Or | = | Any unless defined?(Or) | Alias for Contract::Check::Any | |
Not | = | None unless defined?(Not) | Alias for Contract::Check::None |
Short-cut for creating a Contract::Check::Block.
# File lib/contract/integration.rb, line 42 42: def self.block(&block) # :yields: arg 43: Block.new(&block) 44: end