Module: Eavesdropping
- Defined in:
- lib/eavesdropping.rb,
lib/eavesdropping/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
Class Method Details
.start(object) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/eavesdropping.rb', line 5 def start(object) klass = object.singleton_class object.public_methods.each do |method| klass.send(:define_method, "#{method}_with_eavesdropping") do |*args| yield(method, args) object.send_without_eavesdropping("#{method}_without_eavesdropping", *args) end klass.send(:alias_method, "#{method}_without_eavesdropping", method) klass.send(:alias_method, method, "#{method}_with_eavesdropping") end end |