class Pry::Method::WeirdMethodLocator

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.