2013-01-21 14:08:30 -05:00
|
|
|
module Mutant
|
|
|
|
class CLI
|
|
|
|
class Classifier
|
|
|
|
|
|
|
|
# Namespace classifier
|
|
|
|
class Namespace < self
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
# Return matcher
|
|
|
|
#
|
|
|
|
# @return [Matcher]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def matcher
|
2013-04-20 20:36:21 -04:00
|
|
|
self.class::MATCHER.new(namespace)
|
2013-01-21 14:08:30 -05:00
|
|
|
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)
|
2013-01-21 14:08:30 -05:00
|
|
|
end
|
2013-04-20 20:36:21 -04:00
|
|
|
|
|
|
|
# Recursive namespace classifier
|
|
|
|
class Recursive < self
|
|
|
|
REGEXP = %r(\A(#{SCOPE_PATTERN})\*\z).freeze
|
|
|
|
MATCHER = Matcher::Namespace
|
|
|
|
register
|
|
|
|
end
|
|
|
|
|
|
|
|
# Recursive namespace classifier
|
|
|
|
class Flat < self
|
|
|
|
REGEXP = %r(\A(#{SCOPE_PATTERN})\z).freeze
|
|
|
|
MATCHER = Matcher::Scope
|
|
|
|
register
|
|
|
|
end
|
2013-01-21 14:08:30 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|