Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/stunted/mocking.rb
Instance Method Summary collapse
Instance Method Details
#with_replacement_methods(hash) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/stunted/mocking.rb', line 2 def with_replacement_methods(hash) old_pairs = hash.collect do | key, value | old_method = instance_method(key) define_method(key, value) [key, old_method] end yield ensure old_pairs.each { | pair | define_method(*pair) } end |