Fix style issue in Mutant::CLI*
This commit is contained in:
parent
07ddb9b70e
commit
a9ae9932ec
2 changed files with 12 additions and 6 deletions
|
@ -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,7 +38,10 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def self.constant_lookup(location)
|
||||
location.gsub(CBASE_PATTERN, EMPTY_STRING).split(SCOPE_OPERATOR).reduce(Object) do |parent, name|
|
||||
location
|
||||
.gsub(CBASE_PATTERN, EMPTY_STRING)
|
||||
.split(SCOPE_OPERATOR)
|
||||
.reduce(Object) do |parent, name|
|
||||
parent.const_get(name)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue