Class: NRSER::MethodMissingForwarder
- Inherits:
- BasicObject
- Defined in:
- lib/nrser/sugar/method_missing_forwarder.rb
Overview
A very simple class that forwards all method calls to the block it was initialized with (via #method_missing).
Instance Method Summary collapse
-
#initialize(&forwarder) ⇒ MethodMissingForwarder
constructor
Instantiate a new ‘NRSER::MethodMissingForwarder` holding the forwarding block.
-
#method_missing(symbol, *args, &block) ⇒ Object
Forwards all params to the ‘@forwarder` proc.
Constructor Details
#initialize(&forwarder) ⇒ MethodMissingForwarder
Instantiate a new ‘NRSER::MethodMissingForwarder` holding the forwarding block.
27 28 29 |
# File 'lib/nrser/sugar/method_missing_forwarder.rb', line 27 def initialize &forwarder @forwarder = forwarder end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args, &block) ⇒ Object
Forwards all params to the ‘@forwarder` proc.
46 47 48 |
# File 'lib/nrser/sugar/method_missing_forwarder.rb', line 46 def method_missing symbol, *args, &block @forwarder.call symbol, *args, &block end |