Module: Leftovers::MatcherBuilders::NodeHasPositionalArgument

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

Class Method Summary collapse

Class Method Details

.build(positions, value_matcher) ⇒ Object



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

def build(positions, value_matcher)
  positions = ::Leftovers.wrap_array(positions)
  if !positions.empty? && !all_positions?(positions) && value_matcher
    build_has_positional_value_matcher(positions, value_matcher)
  elsif !positions.empty? && !value_matcher
    build_has_position_matcher(positions)
  elsif value_matcher
    build_has_any_positional_value_matcher(value_matcher)
  end
end