Class: Bogus::MethodCallProxy
- Inherits:
- BasicObject
- Defined in:
- lib/bogus/proxies_method_calls.rb
Instance Method Summary collapse
-
#initialize(&on_called) ⇒ MethodCallProxy
constructor
A new instance of MethodCallProxy.
- #method_missing(name, *args, &block) ⇒ Object
- #raise(*args) ⇒ Object
Constructor Details
#initialize(&on_called) ⇒ MethodCallProxy
Returns a new instance of MethodCallProxy.
11 12 13 |
# File 'lib/bogus/proxies_method_calls.rb', line 11 def initialize(&on_called) @on_called = on_called end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
19 20 21 |
# File 'lib/bogus/proxies_method_calls.rb', line 19 def method_missing(name, *args, &block) @on_called.call(name, *args, &block) end |
Instance Method Details
#raise(*args) ⇒ Object
15 16 17 |
# File 'lib/bogus/proxies_method_calls.rb', line 15 def raise(*args) ::Kernel.raise(*args) end |