Class: Strict::Validators::AnyOf
- Inherits:
-
Object
- Object
- Strict::Validators::AnyOf
- Defined in:
- lib/strict/validators/any_of.rb
Instance Attribute Summary collapse
-
#subvalidators ⇒ Object
readonly
Returns the value of attribute subvalidators.
Instance Method Summary collapse
- #===(value) ⇒ Object
-
#initialize(*subvalidators) ⇒ AnyOf
constructor
A new instance of AnyOf.
- #inspect ⇒ Object (also: #to_s)
Constructor Details
#initialize(*subvalidators) ⇒ AnyOf
Returns a new instance of AnyOf.
8 9 10 |
# File 'lib/strict/validators/any_of.rb', line 8 def initialize(*subvalidators) @subvalidators = subvalidators end |
Instance Attribute Details
#subvalidators ⇒ Object (readonly)
Returns the value of attribute subvalidators.
6 7 8 |
# File 'lib/strict/validators/any_of.rb', line 6 def subvalidators @subvalidators end |
Instance Method Details
#===(value) ⇒ Object
12 13 14 15 16 |
# File 'lib/strict/validators/any_of.rb', line 12 def ===(value) subvalidators.any? do |subvalidator| subvalidator === value end end |
#inspect ⇒ Object Also known as: to_s
18 19 20 |
# File 'lib/strict/validators/any_of.rb', line 18 def inspect "AnyOf(#{subvalidators.map(&:inspect).join(', ')})" end |