Module: Leftovers::MatcherBuilders::NodeHasArgument

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

Class Method Summary collapse

Class Method Details

.build(patterns) ⇒ Object



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

def build(patterns)
  Or.each_or_self(patterns) do |pat|
    case pat
    when ::String then NodeHasKeywordArgument.build(pat, nil)
    when ::Integer then NodeHasPositionalArgument.build(pat, nil)
    when ::Hash then build_from_hash(**pat)
    # :nocov:
    else raise UnexpectedCase, "Unhandled value #{pat.inspect}"
      # :nocov:
    end
  end
end