Class: Contracts::Builtin::And
- Inherits:
-
CallableClass
- Object
- CallableClass
- Contracts::Builtin::And
- Defined in:
- lib/contracts/builtin_contracts.rb
Overview
Takes a variable number of contracts. The contract passes if all contracts pass. Example: And[Fixnum, Float]
Instance Method Summary collapse
-
#initialize(*vals) ⇒ And
constructor
A new instance of And.
- #to_s ⇒ Object
- #valid?(val) ⇒ Boolean
Methods inherited from CallableClass
Constructor Details
#initialize(*vals) ⇒ And
Returns a new instance of And.
144 145 146 |
# File 'lib/contracts/builtin_contracts.rb', line 144 def initialize(*vals) @vals = vals end |
Instance Method Details
#to_s ⇒ Object
155 156 157 |
# File 'lib/contracts/builtin_contracts.rb', line 155 def to_s EnumInspector.inspect(@vals, "and") end |