Sha256: 093d17516e142d68bf16135f260d467d4038990799ca07cbda674c39253b20be
Contents?: true
Size: 567 Bytes
Versions: 3
Compression:
Stored size: 567 Bytes
Contents
class Object def stub name, val_or_callable, &block new_name = "__minitest_stub__#{name}" metaclass = class << self; self; end metaclass.send :alias_method, new_name, name metaclass.send :define_method, name do |*args, &stub_block| if val_or_callable.respond_to? :call then val_or_callable.call(*args, &stub_block) else val_or_callable end end yield self ensure metaclass.send :undef_method, name metaclass.send :alias_method, name, new_name metaclass.send :undef_method, new_name end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
omf_common-6.0.0.pre.10 | lib/omf_common/core_ext/object.rb |
omf_common-6.0.0.pre.8 | lib/omf_common/core_ext/object.rb |
omf_common-6.0.0.pre.7 | lib/omf_common/core_ext/object.rb |