Class: Mutant::Matcher::Method

Inherits:
Mutant::Matcher show all
Includes:
Adamantium::Flat
Defined in:
lib/mutant/matcher/method.rb,
lib/mutant/matcher/method/instance.rb,
lib/mutant/matcher/method/singleton.rb,
lib/mutant/matcher/method/classifier.rb

Overview

Matcher for subjects that are a specific method

Direct Known Subclasses

Instance, Singleton

Defined Under Namespace

Classes: Classifier, Instance, Singleton

Constant Summary collapse

BLACKLIST =

Methods within rbx kernel directory are precompiled and their source cannot be accessed via reading source location

/\Akernel\//.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Mutant::Matcher

from_string, #identification

Instance Attribute Details

#methodUnboundMethod, Method (readonly)

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

Returns:



51
52
53
# File 'lib/mutant/matcher/method.rb', line 51

def method
  @method
end

#scopeClass|Module (readonly)

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 scope

Returns:

  • (Class|Module)


59
60
61
# File 'lib/mutant/matcher/method.rb', line 59

def scope
  @scope
end

Class Method Details

.parse(input) ⇒ 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.

Parse a method string into filter

Parameters:

  • input (String)

Returns:



15
16
17
# File 'lib/mutant/matcher/method.rb', line 15

def self.parse(input)
  Classifier.run(input)
end

Instance Method Details

#each(&block) ⇒ Enumerable, self

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.

Enumerate matches

Returns:

  • (Enumerable)

    returns enumerable when no block given

  • (self)

    returns self when block given



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/mutant/matcher/method.rb', line 33

def each(&block)
  return to_enum unless block_given?

  return self if skip?

  subject.tap do |subject|
    yield subject if subject
  end

  self
end

#method_nameString

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 name

Returns:

  • (String)


67
68
69
# File 'lib/mutant/matcher/method.rb', line 67

def method_name
  method.name
end

#public?true, false

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.

Test if method is public

Returns:

  • (true)

    if method is public

  • (false)

    otherwise



81
# File 'lib/mutant/matcher/method.rb', line 81

abstract_method :public?