class Fear::Extractor::Matcher::And

Combine two matchers, so both should pass

Attributes

matcher1[R]
matcher2[R]

Public Class Methods

new(matcher1, matcher2) click to toggle source
# File lib/fear/extractor/matcher/and.rb, line 10
def initialize(matcher1, matcher2)
  @matcher1 = matcher1
  @matcher2 = matcher2
end

Public Instance Methods

bindings(arg) click to toggle source
# File lib/fear/extractor/matcher/and.rb, line 20
def bindings(arg)
  matcher1.bindings(arg).merge(matcher2.bindings(arg))
end
defined_at?(arg) click to toggle source
# File lib/fear/extractor/matcher/and.rb, line 16
def defined_at?(arg)
  matcher1.defined_at?(arg) && matcher2.defined_at?(arg)
end
failure_reason(arg) click to toggle source
# File lib/fear/extractor/matcher/and.rb, line 24
def failure_reason(arg)
  if matcher1.defined_at?(arg)
    if matcher2.defined_at?(arg)
      Fear.none
    else
      matcher2.failure_reason(arg)
    end
  else
    matcher1.failure_reason(arg)
  end
end