Class: Mutant::Matcher::Method::Instance

Inherits:
Mutant::Matcher::Method show all
Defined in:
lib/mutant/matcher/method/instance.rb

Overview

Matcher for instance methods

Direct Known Subclasses

Memoized

Defined Under Namespace

Classes: Memoized

Constant Summary collapse

SUBJECT_CLASS =
Subject::Method::Instance
NAME_INDEX =
0

Constants inherited from Mutant::Matcher::Method

BLACKLIST

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Mutant::Matcher::Method

#each

Methods inherited from Mutant::Matcher

#each

Class Method Details

.build(env, scope, target_method) ⇒ Matcher::Method::Instance

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.

Dispatching builder, detects memoizable case


18
19
20
21
22
23
24
# File 'lib/mutant/matcher/method/instance.rb', line 18

def self.build(env, scope, target_method)
  name = target_method.name
  if scope.ancestors.include?(::Memoizable) && scope.memoized?(name)
    return Memoized.new(env, scope, target_method)
  end
  super
end

Instance Method Details

#identificationString

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 identification


32
33
34
# File 'lib/mutant/matcher/method/instance.rb', line 32

def identification
  "#{scope.name}##{method_name}"
end