class Fear::Extractor::ArrayMatcher
Recursive array matcher. Match against its head and tail
Public Instance Methods
bindings(other)
click to toggle source
# File lib/fear/extractor/array_matcher.rb, line 19 def bindings(other) if head.is_a?(ArraySplatMatcher) head.bindings(other) else head.bindings(other).merge(tail.bindings(other.slice(1..-1))) end end
defined_at?(other)
click to toggle source
@!attribute head
@return [ArrayHeadMatcher]
@!attribute tail
@return [ArrayMatcher | EmptyListMatcher]
# File lib/fear/extractor/array_matcher.rb, line 13 def defined_at?(other) if other.is_a?(Array) head.defined_at?(other) && tail.defined_at?(other.slice(1..-1)) end end
failure_reason(other)
click to toggle source
Calls superclass method
# File lib/fear/extractor/array_matcher.rb, line 27 def failure_reason(other) if other.is_a?(Array) if head.defined_at?(other) tail.failure_reason(other.slice(1..-1)) else head.failure_reason(other) end else super end end