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, SKIP_METHODS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Mutant::Matcher::Method

#each

Methods inherited from Mutant::Matcher

each, #each

Class Method Details

.build(cache, scope, 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 adamantium case

Parameters:

  • cache (Cache)
  • scope (Class, Module)
  • method (UnboundMethod)

Returns:



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

def self.build(cache, scope, method)
  name = method.name
  if scope.ancestors.include?(::Adamantium) and scope.memoized?(name)
    return Memoized.new(cache, scope, 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

Returns:

  • (String)


34
35
36
# File 'lib/mutant/matcher/method/instance.rb', line 34

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