Module: Contract::Check
- Defined in:
- lib/contract/integration.rb
Overview
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]
]
]
Defined Under Namespace
Classes: All, Any, Base, Block, None, Quack
Constant Summary collapse
- And =
Alias for Contract::Check::All
All
- Or =
Alias for Contract::Check::Any
Any
- Not =
Alias for Contract::Check::None
None
Class Method Summary collapse
-
.block(&block) ⇒ Object
Short-cut for creating a Contract::Check::Block.