Class: Leftovers::Matchers::Any

Inherits:
Object
  • Object
show all
Includes:
ComparableInstance
Defined in:
lib/leftovers/matchers/any.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ComparableInstance

#eql?, #hash

Constructor Details

#initialize(matchers) ⇒ Any

Returns a new instance of Any.



10
11
12
13
14
# File 'lib/leftovers/matchers/any.rb', line 10

def initialize(matchers)
  @matchers = matchers

  freeze
end

Instance Attribute Details

#matchersObject (readonly)

Returns the value of attribute matchers.



8
9
10
# File 'lib/leftovers/matchers/any.rb', line 8

def matchers
  @matchers
end

Instance Method Details

#===(value) ⇒ Object



16
17
18
19
20
# File 'lib/leftovers/matchers/any.rb', line 16

def ===(value)
  @matchers.any? do |matcher|
    matcher === value
  end
end