Class: Fancygrid::ObjectWrapper
- Inherits:
-
Object
- Object
- Fancygrid::ObjectWrapper
- Defined in:
- lib/fancygrid/object_wrapper.rb
Instance Method Summary collapse
-
#initialize(obj) ⇒ ObjectWrapper
constructor
Initializes the object wrapper.
-
#method_missing(method, *args, &block) ⇒ Object
Sends the missing method to the wrapped object and stores the result as the new wrapped object.
-
#object ⇒ Object
Gets the wrapped object.
Constructor Details
#initialize(obj) ⇒ ObjectWrapper
Initializes the object wrapper
6 7 8 |
# File 'lib/fancygrid/object_wrapper.rb', line 6 def initialize obj @wrapped = obj end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
Sends the missing method to the wrapped object and stores the result as the new wrapped object
19 20 21 22 |
# File 'lib/fancygrid/object_wrapper.rb', line 19 def method_missing(method, *args, &block) @wrapped = @wrapped.send(method, *args) return self end |
Instance Method Details
#object ⇒ Object
Gets the wrapped object
12 13 14 |
# File 'lib/fancygrid/object_wrapper.rb', line 12 def object @wrapped end |