Class: Mutant::Expression::Method Private

Inherits:
Mutant::Expression show all
Defined in:
lib/mutant/expression/method.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Explicit method expression

Constant Summary collapse

MATCHERS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

IceNine.deep_freeze(
  '.' => [Matcher::Methods::Singleton, Matcher::Methods::Metaclass],
  '#' => [Matcher::Methods::Instance]
)
METHOD_NAME_PATTERN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Regexp.union(
  /(?<method_name>[A-Za-z_][A-Za-z\d_]*[!?=]?)/,
  *AST::Types::OPERATOR_METHODS.map(&:to_s)
).freeze
REGEXP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

/\A#{SCOPE_NAME_PATTERN}#{SCOPE_SYMBOL_PATTERN}#{METHOD_NAME_PATTERN}\z/.freeze

Constants inherited from Mutant::Expression

SCOPE_NAME_PATTERN, SCOPE_SYMBOL_PATTERN

Instance Method Summary collapse

Methods inherited from Mutant::Expression

#match_length, #prefix?, try_parse

Instance Method Details

#matcherMatcher

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Matcher for expression



41
42
43
44
45
46
47
48
# File 'lib/mutant/expression/method.rb', line 41

def matcher
  matcher_candidates = MATCHERS.fetch(scope_symbol)
    .map { |submatcher| submatcher.new(scope) }

  methods_matcher = Matcher::Chain.new(matcher_candidates)

  Matcher::Filter.new(methods_matcher, ->(subject) { subject.expression.eql?(self) })
end

#syntaxString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Syntax of expression



33
34
35
# File 'lib/mutant/expression/method.rb', line 33

def syntax
  [scope_name, scope_symbol, method_name].join
end