Class: MayI::Proxy
- Inherits:
-
Object
- Object
- MayI::Proxy
- Defined in:
- lib/mayi/proxy.rb
Instance Method Summary collapse
-
#initialize(target, &block) ⇒ Proxy
constructor
A new instance of Proxy.
Constructor Details
#initialize(target, &block) ⇒ Proxy
Returns a new instance of Proxy.
5 6 7 8 |
# File 'lib/mayi/proxy.rb', line 5 def initialize(target,&block) @target = target @block = block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object (protected)
12 13 14 15 16 17 |
# File 'lib/mayi/proxy.rb', line 12 def method_missing(name, *args, &block) @block.call(:before) @target.send(name, *args, &block) ensure @block.call(:after) end |