module Leftovers::MatcherBuilders::NodeType

Public Class Methods

build(types_pattern) click to toggle source
# File lib/leftovers/matcher_builders/node_type.rb, line 8
def self.build(types_pattern)
  ::Leftovers::MatcherBuilders::Or.each_or_self(types_pattern) do |type|
    case type
    when 'Symbol' then ::Leftovers::Matchers::NodeType.new(:sym)
    when 'String' then ::Leftovers::Matchers::NodeType.new(:str)
    when 'Integer' then ::Leftovers::Matchers::NodeType.new(:int)
    when 'Float' then ::Leftovers::Matchers::NodeType.new(:float)
    # these would be neat but i can't think of a use-case
    # when 'Array' then :array
    # when 'Hash' then :hash
    # when 'Method' then Set[:send, :csend, :def]
    # when 'Constant' then Set[:const, :class, :module]
    # :nocov:
    else raise
      # :nocov:
    end
  end
end