Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (18 sloc) 0.606 kb
require 'metaclass'
module Mocha
module ObjectMethods
def define_instance_method(method_symbol, &block)
__metaclass__.send(:define_method, method_symbol, block)
end
def replace_instance_method(method_symbol, &block)
raise "Cannot replace #{method_symbol} as #{self} does not respond to it." unless self.respond_to?(method_symbol)
define_instance_method(method_symbol, &block)
end
def define_instance_accessor(*symbols)
symbols.each { |symbol| __metaclass__.send(:attr_accessor, symbol) }
end
end
end
class Object
include Mocha::ObjectMethods
end
Jump to Line
Something went wrong with that request. Please try again.