free_mutant/lib/mutant/cli/classifier/namespace.rb

48 lines
979 B
Ruby
Raw Normal View History

module Mutant
class CLI
class Classifier
# Namespace classifier
class Namespace < self
private
# Return matcher
#
# @return [Matcher]
#
# @api private
#
def matcher
self.class::MATCHER.new(namespace)
end
# Return namespace
#
# @return [Class, Module]
#
# @api private
#
def namespace
2013-04-19 16:24:26 -04:00
Classifier.constant_lookup(match[1].to_s)
end
# Recursive namespace classifier
class Recursive < self
REGEXP = %r(\A(#{SCOPE_PATTERN})\*\z).freeze
MATCHER = Matcher::Namespace
register
2013-06-14 14:54:02 -04:00
end # Recursive
# Recursive namespace classifier
class Flat < self
REGEXP = %r(\A(#{SCOPE_PATTERN})\z).freeze
MATCHER = Matcher::Scope
register
2013-06-14 14:54:02 -04:00
end # Flat
end # Namespace
end # Classifier
end # CLI
end # Mutant