Sha256: 7bf83b45bc74974baa3ddea381140db48209b1fd6522beda5bb65a73a8c05087
Contents?: true
Size: 606 Bytes
Versions: 77
Compression:
Stored size: 606 Bytes
Contents
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
Version data entries
77 entries across 62 versions & 7 rubygems