class Pry::Method::Disowned

This occurs mainly in Sinatra applications.
In this case we assume that the “owner” is the singleton class of the receiver.
end
end
Pry::Method.from_binding(binding)
C.send(:undefine_method, :foo)
def foo
class C
e.g.
A Disowned Method is one that’s been removed from the class on which it was defined.

def initialize(receiver, method_name, binding=nil)

Parameters:
  • method_name (String) --
  • receiver (Object) --
def initialize(receiver, method_name, binding=nil)
  @receiver, @name = receiver, method_name
end

def method_missing(meth_name, *args, &block)

Raise a more useful error message instead of trying to forward to nil.
def method_missing(meth_name, *args, &block)
  raise "Cannot call '#{meth_name}' on an undef'd method." if method(:name).respond_to?(meth_name)
  Object.instance_method(:method_missing).bind(self).call(meth_name, *args, &block)
end

def owner

Returns:
  • (Object) -
def owner
  class << receiver; self; end
end

def source?

Returns:
  • (Boolean) - false
def source?
  false
end

def undefined?

Returns:
  • (Boolean) - true
def undefined?
  true
end