lib/mutant/expression/method.rb in mutant-0.8.8 vs lib/mutant/expression/method.rb in mutant-0.8.9
- old
+ new
@@ -1,11 +1,16 @@
module Mutant
class Expression
# Explicit method expression
class Method < self
- include Anima.new(:scope_name, :scope_symbol, :method_name)
+ include Anima.new(
+ :method_name,
+ :scope_name,
+ :scope_symbol
+ )
+
private(*anima.attribute_names)
MATCHERS = IceNine.deep_freeze(
'.' => Matcher::Methods::Singleton,
'#' => Matcher::Methods::Instance
@@ -21,22 +26,18 @@
REGEXP = /\A#{SCOPE_NAME_PATTERN}#{SCOPE_SYMBOL_PATTERN}#{METHOD_NAME_PATTERN}\z/.freeze
# Syntax of expression
#
# @return [String]
- #
- # @api private
def syntax
[scope_name, scope_symbol, method_name].join
end
memoize :syntax
# Matcher for expression
#
# @return [Matcher]
- #
- # @api private
def matcher
methods_matcher = MATCHERS.fetch(scope_symbol).new(scope)
Matcher::Filter.new(methods_matcher, ->(subject) { subject.expression.eql?(self) })
end
@@ -44,11 +45,9 @@
private
# Scope object
#
# @return [Class, Method]
- #
- # @api private
def scope
Object.const_get(scope_name)
end
end # Method