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)

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

def method_missing(method_name, *args, &block)

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

def owner

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

def respond_to_missing?(method_name, include_private = false)

def respond_to_missing?(method_name, include_private = false)
  !method(:name).respond_to?(method_name) || super
end

def source?

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

def undefined?

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