Class: Line::Matchers::Or

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/line/matchers/or.rb

Instance Method Summary collapse

Methods included from Helpers

#inspect_helper

Constructor Details

#initialize(matcher1, matcher2) ⇒ Or

Returns a new instance of Or.



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

def initialize(matcher1, matcher2)
  @matcher1, @matcher2 = matcher1, matcher2
end

Instance Method Details

#inspect(parent = false) ⇒ Object



16
17
18
# File 'lib/line/matchers/or.rb', line 16

def inspect(parent=false)
  inspect_helper parent, "#{@matcher1.inspect self} || #{@matcher2.inspect self}", true
end

#matches?(*args) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/line/matchers/or.rb', line 12

def matches?(*args)
  @matcher1.matches?(*args) || @matcher2.matches?(*args)
end