Class: Strict::Validators::AllOf

Inherits:
Object
  • Object
show all
Defined in:
lib/strict/validators/all_of.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*subvalidators) ⇒ AllOf

Returns a new instance of AllOf.



8
9
10
# File 'lib/strict/validators/all_of.rb', line 8

def initialize(*subvalidators)
  @subvalidators = subvalidators
end

Instance Attribute Details

#subvalidatorsObject (readonly)

Returns the value of attribute subvalidators.



6
7
8
# File 'lib/strict/validators/all_of.rb', line 6

def subvalidators
  @subvalidators
end

Instance Method Details

#===(value) ⇒ Object



12
13
14
15
16
# File 'lib/strict/validators/all_of.rb', line 12

def ===(value)
  subvalidators.all? do |subvalidator|
    subvalidator === value
  end
end

#inspectObject Also known as: to_s



18
19
20
# File 'lib/strict/validators/all_of.rb', line 18

def inspect
  "AllOf(#{subvalidators.map(&:inspect).join(', ')})"
end