Sha256: 8152af225412895046eb9b916b857bf8161f4b42ba92b61e990c6fde625f3ff7
Contents?: true
Size: 688 Bytes
Versions: 8
Compression:
Stored size: 688 Bytes
Contents
module Bogus module HasOverwritenMethods def __overwritten_methods__ @__overwritten_methods__ ||= {} end def __overwrite__(name, method, body) return if __overwritten_methods__[name] method = method.to_proc if method __overwritten_methods__[name] = method || :no_such_method instance_eval(body) end def __reset__ __overwritten_methods__.each do |name, method| method = __overwritten_methods__.delete(name) instance_eval "undef #{name}" next if method == :no_such_method define_singleton_method(name, method) end @__overwritten_methods__ = {} @__shadow__ = nil end end end
Version data entries
8 entries across 8 versions & 1 rubygems