Module Contract::Check
In: lib/contract/integration.rb
Method Contract Module UnboundMethod Contract::Check::Any Contract::Check::All Contract::Check::None Contract::Check::Block Contract::Check::Base Contract::Check::Quack MethodSignatureMixin Kernel 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]
    ]
  ]

Methods

block  

Classes and Modules

Class Contract::Check::All
Class Contract::Check::Any
Class Contract::Check::Block
Class Contract::Check::None
Class Contract::Check::Quack

Constants

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

Public Class methods

Short-cut for creating a Contract::Check::Block.

[Source]

    # File lib/contract/integration.rb, line 42
42:     def self.block(&block) # :yields: arg
43:       Block.new(&block)
44:     end

[Validate]