Module: Leftovers::MatcherBuilders::And

Defined in:
lib/leftovers/matcher_builders/and.rb

Class Method Summary collapse

Class Method Details

.build(matchers) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/leftovers/matcher_builders/and.rb', line 7

def build(matchers)
  matchers = flatten(matchers).compact
  case matchers.length
  when 0 then nil
  when 1 then matchers.first
  when 2 then Matchers::And.new(matchers.first, matchers[1])
  else Matchers::All.new(matchers.dup)
  end
end