Class: Contracts::Builtin::Or
- Inherits:
-
CallableClass
- Object
- CallableClass
- Contracts::Builtin::Or
- Defined in:
- lib/contracts/builtin_contracts.rb
Overview
Takes a variable number of contracts. The contract passes if any of the contracts pass. Example: Or[Fixnum, Float]
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(*vals) ⇒ Or
constructor
A new instance of Or.
- #to_s ⇒ Object
- #valid?(val) ⇒ Boolean
Methods inherited from CallableClass
Constructor Details
#initialize(*vals) ⇒ Or
Returns a new instance of Or.
103 104 105 |
# File 'lib/contracts/builtin_contracts.rb', line 103 def initialize(*vals) @vals = vals end |
Instance Method Details
#to_s ⇒ Object
114 115 116 |
# File 'lib/contracts/builtin_contracts.rb', line 114 def to_s EnumInspector.inspect(@vals, "or") end |