Sha256: 36a2f85ab2f5c3e7ba09e50197a73ac9bcc3507cd28a88276024a5c6ce62dd7f

Contents?: true

Size: 833 Bytes

Versions: 12

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true

module Leftovers
  module MatcherBuilders
    module Name
      def self.build(patterns) # rubocop:disable Metrics/MethodLength
        ::Leftovers::MatcherBuilders::Or.each_or_self(patterns) do |pat|
          case pat
          when nil
          when ::Array
            ::Leftovers::MatcherBuilders::Name.build(pat)
          when ::String
            ::Leftovers::MatcherBuilders::String.build(pat)
          when ::Hash
            unless_arg = pat.delete(:unless_arg)

            ::Leftovers::MatcherBuilders::AndNot.build(
              ::Leftovers::MatcherBuilders::StringPattern.build(**pat),
              ::Leftovers::MatcherBuilders::Name.build(unless_arg)
            )
          # :nocov:
          else raise
            # :nocov:
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
leftovers-0.7.0 lib/leftovers/matcher_builders/name.rb
leftovers-0.6.0 lib/leftovers/matcher_builders/name.rb
leftovers-0.5.5 lib/leftovers/matcher_builders/name.rb
leftovers-0.5.4 lib/leftovers/matcher_builders/name.rb
leftovers-0.5.3 lib/leftovers/matcher_builders/name.rb
leftovers-0.5.2 lib/leftovers/matcher_builders/name.rb
leftovers-0.5.1 lib/leftovers/matcher_builders/name.rb
leftovers-0.5.0 lib/leftovers/matcher_builders/name.rb
leftovers-0.4.3 lib/leftovers/matcher_builders/name.rb
leftovers-0.4.2 lib/leftovers/matcher_builders/name.rb
leftovers-0.4.1 lib/leftovers/matcher_builders/name.rb
leftovers-0.4.0 lib/leftovers/matcher_builders/name.rb