49133680ee
At least this dramatically speeds up unit tests. And this is a good thing.
47 lines
986 B
Ruby
47 lines
986 B
Ruby
module Mutant
|
|
class CLI
|
|
class Classifier
|
|
|
|
# Namespace classifier
|
|
class Namespace < self
|
|
|
|
private
|
|
|
|
# Return matcher
|
|
#
|
|
# @return [Matcher]
|
|
#
|
|
# @api private
|
|
#
|
|
def matcher
|
|
self.class::MATCHER.new(cache, namespace)
|
|
end
|
|
|
|
# Return namespace
|
|
#
|
|
# @return [Class, Module]
|
|
#
|
|
# @api private
|
|
#
|
|
def namespace
|
|
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
|
|
end # Recursive
|
|
|
|
# Recursive namespace classifier
|
|
class Flat < self
|
|
REGEXP = %r(\A(#{SCOPE_PATTERN})\z).freeze
|
|
MATCHER = Matcher::Scope
|
|
register
|
|
end # Flat
|
|
|
|
end # Namespace
|
|
end # Classifier
|
|
end # CLI
|
|
end # Mutant
|