Module: Leftovers::MatcherBuilders::Name

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

Class Method Summary collapse

Class Method Details

.build(patterns) ⇒ Object



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

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