Class: Mal::ArrayT

Inherits:
OnlyT
  • Object
show all
Defined in:
lib/mal.rb

Instance Method Summary collapse

Methods inherited from OnlyT

#&, #|

Constructor Details

#initialize(matcher_for_each_array_element) ⇒ ArrayT

Returns a new instance of ArrayT.



169
170
171
# File 'lib/mal.rb', line 169

def initialize(matcher_for_each_array_element)
  @matcher_for_each_array_element = matcher_for_each_array_element
end

Instance Method Details

#===(value) ⇒ Object



173
174
175
176
177
178
179
180
# File 'lib/mal.rb', line 173

def ===(value)
  return false unless Array === value
  return false unless value.any?
  value.each do |value_element|
    return false unless @matcher_for_each_array_element === value_element
  end
  true
end

#inspectObject



182
183
184
# File 'lib/mal.rb', line 182

def inspect
  'ArrayOf(%s)' % @matcher_for_each_array_element.inspect
end