Class: Mutant::Expression::Method

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

Overview

Explicit method 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

#initialize, #match_length, parse, #prefix?, try_parse

Constructor Details

This class inherits a constructor from Mutant::Expression

Instance Method Details

#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
27
28
29
30
# File 'lib/mutant/expression/method.rb', line 24

def matcher(env)
  methods_matcher = MATCHERS.fetch(scope_symbol).new(env, scope)
  method = methods_matcher.methods.detect do |meth|
    meth.name.equal?(method_name)
  end or raise NameError, "Cannot find method #{method_name}"
  methods_matcher.matcher.build(env, scope, method)
end