Sha256: adb64938ad02fd1cedcaa5d8e91a5d44ff944d877b082feb84961175041f7af8
Contents?: true
Size: 615 Bytes
Versions: 34
Compression:
Stored size: 615 Bytes
Contents
require 'mocha/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
34 entries across 34 versions & 10 rubygems