Fix style issue in Mutant::CLI*

This commit is contained in:
Markus Schirp 2013-07-28 19:00:13 +02:00
parent 07ddb9b70e
commit a9ae9932ec
2 changed files with 12 additions and 6 deletions

View file

@ -8,8 +8,10 @@ module Mutant
SCOPE_NAME_PATTERN = /[A-Za-z][A-Za-z_0-9]*/.freeze
OPERATOR_PATTERN = Regexp.union(*OPERATOR_METHODS.map(&:to_s)).freeze
METHOD_NAME_PATTERN = /([_A-Za-z][A-Za-z0-9_]*[!?=]?|#{OPERATOR_PATTERN})/.freeze
SCOPE_PATTERN = /(?:::)?#{SCOPE_NAME_PATTERN}(?:::#{SCOPE_NAME_PATTERN})*/.freeze
METHOD_NAME_PATTERN =
/([_A-Za-z][A-Za-z0-9_]*[!?=]?|#{OPERATOR_PATTERN})/.freeze
SCOPE_PATTERN =
/(?:::)?#{SCOPE_NAME_PATTERN}(?:::#{SCOPE_NAME_PATTERN})*/.freeze
CBASE_PATTERN = /\A::/.freeze
SCOPE_OPERATOR = '::'.freeze
SINGLETON_PATTERN = /\A(#{SCOPE_PATTERN})\z/.freeze
@ -36,9 +38,12 @@ module Mutant
# @api private
#
def self.constant_lookup(location)
location.gsub(CBASE_PATTERN, EMPTY_STRING).split(SCOPE_OPERATOR).reduce(Object) do |parent, name|
parent.const_get(name)
end
location
.gsub(CBASE_PATTERN, EMPTY_STRING)
.split(SCOPE_OPERATOR)
.reduce(Object) do |parent, name|
parent.const_get(name)
end
end
# Return matchers for input

View file

@ -10,7 +10,8 @@ module Mutant
'#' => Matcher::Methods::Instance
}.freeze
REGEXP = /\A(#{SCOPE_PATTERN})([.#])(#{METHOD_NAME_PATTERN}\z)/.freeze
REGEXP =
%r(\A(#{SCOPE_PATTERN})([.#])(#{METHOD_NAME_PATTERN}\z)).freeze
# Positions of captured regexp groups
SCOPE_NAME_POSITION = 1