Class: Mutant::Expression::Methods Private

Inherits:
Mutant::Expression show all
Defined in:
lib/mutant/expression/methods.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.

Abstract base class for methods 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]
)
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}\z/.freeze

Constants inherited from Mutant::Expression

SCOPE_NAME_PATTERN, SCOPE_SYMBOL_PATTERN

Instance Method Summary collapse

Methods inherited from Mutant::Expression

#prefix?, try_parse

Instance Method Details

#match_length(expression) ⇒ Integer

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.

Length of match with other expression

Parameters:

Returns:

  • (Integer)


46
47
48
49
50
51
52
# File 'lib/mutant/expression/methods.rb', line 46

def match_length(expression)
  if expression.syntax.start_with?(syntax)
    syntax.length
  else
    0
  end
end

#matcherMatcher::Method

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 on expression

Returns:



34
35
36
37
38
39
# File 'lib/mutant/expression/methods.rb', line 34

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

  Matcher::Chain.new(matcher_candidates)
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

Returns:

  • (String)


26
27
28
# File 'lib/mutant/expression/methods.rb', line 26

def syntax
  [scope_name, scope_symbol].join
end