class RSpec::Mocks::MethodReference

@private
Represents a method on a module that may or may not be defined.

def defined?

In that case, we can assert against metadata like the arity.
A method is defined if we are able to get a `Method` object for it.
def defined?
  @module_reference.when_loaded do |m|
    method_defined?(m)
  end
end

def implemented?

`method_missing`.
a `NoMethodError`. It might be dynamically implemented by
A method is implemented if sending the message does not result in
def implemented?
  @module_reference.when_loaded do |m|
    method_implemented?(m)
  end
end

def initialize(module_reference, method_name)

def initialize(module_reference, method_name)
  @module_reference = module_reference
  @method_name = method_name
end

def original_method

def original_method
  @module_reference.when_loaded do |m|
    self.defined? && find_method(m)
  end
end

def when_defined

def when_defined
  if original = original_method
    yield original
  end
end

def when_unimplemented

Yields to the block if the method is not implemented.
def when_unimplemented
  yield unless implemented?
end