Class: Mutant::Expression::Methods

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

Overview

Abstract base class for methods expression

Constant Summary collapse

MATCHERS =
IceNine.deep_freeze(
  '.' => Matcher::Methods::Singleton,
  '#' => Matcher::Methods::Instance
)

Constants inherited from Mutant::Expression

INSPECT_FORMAT, METHOD_NAME_PATTERN, REGISTRY, SCOPE_NAME_PATTERN, SCOPE_PATTERN

Instance Attribute Summary

Attributes inherited from Mutant::Expression

#inspect, #syntax

Instance Method Summary collapse

Methods inherited from Mutant::Expression

#_dump, _load, #initialize, parse, #prefix?, try_parse

Constructor Details

This class inherits a constructor from Mutant::Expression

Instance Method Details

#match_length(expression) ⇒ Fixnum

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.

Return length of match



36
37
38
39
40
41
42
# File 'lib/mutant/expression/methods.rb', line 36

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

#matcher(env) ⇒ Matcher::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.

Return method matcher



24
25
26
# File 'lib/mutant/expression/methods.rb', line 24

def matcher(env)
  MATCHERS.fetch(scope_symbol).new(env, scope)
end