module Leftovers::ProcessorBuilders::Keyword

Public Class Methods

build(value, then_processor) click to toggle source
# File lib/leftovers/processor_builders/keyword.rb, line 6
def self.build(value, then_processor) # rubocop:disable Metrics/MethodLength
  return unless value && then_processor

  case value
  when true, '**'
    ::Leftovers::ValueProcessors::EachKeyword.new(then_processor)
  when ::String, ::Hash, ::Array
    ::Leftovers::ValueProcessors::Keyword.new(
      ::Leftovers::MatcherBuilders::NodePairName.build(value),
      then_processor
    )
  # :nocov:
  else raise
    # :nocov:
  end
end