Class Pry::Method::WeirdMethodLocator
In: lib/pry/method/weird_method_locator.rb
Parent: Object

This class is responsible for locating the real `Pry::Method` object captured by a binding.

Given a `Binding` from inside a method and a ‘seed’ Pry::Method object, there are primarily two situations where the seed method doesn‘t match the Binding:

  1. The Pry::Method is from a subclass 2. The Pry::Method represents a method of the same name

while the original was renamed to something else. For 1. we search vertically up the inheritance chain, and for 2. we search laterally along the object‘s method table.

When we locate the method that matches the Binding we wrap it in Pry::Method and return it, or return nil if we fail.

Methods

Attributes

method  [RW] 
target  [RW] 

Public Class methods

@param [Pry::Method] method The seed method. @param [Binding] target The Binding that captures the method

  we want to locate.

Whether the given method object matches the associated binding. If the method object does not match the binding, then it‘s most likely not the method captured by the binding, and we must commence a search.

@param [Pry::Method] method @param [Binding] b @return [Boolean]

Public Instance methods

@return [Pry::Method, nil] The Pry::Method that matches the

  given binding.

@return [Boolean] Whether the Pry::Method is unrecoverable

  This usually happens when the method captured by the Binding
  has been subsequently deleted.

[Validate]