Class: DroidServices::Decorator
- Inherits:
-
Object
- Object
- DroidServices::Decorator
- Defined in:
- lib/droid_services/decorator.rb
Instance Attribute Summary collapse
-
#resource ⇒ Object
Returns the value of attribute resource.
Instance Method Summary collapse
-
#initialize(resource) ⇒ Decorator
constructor
A new instance of Decorator.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(resource) ⇒ Decorator
Returns a new instance of Decorator.
4 5 6 |
# File 'lib/droid_services/decorator.rb', line 4 def initialize(resource) @resource = resource end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
8 9 10 11 12 |
# File 'lib/droid_services/decorator.rb', line 8 def method_missing(method, *args, &block) return super unless resource.respond_to?(method) resource.send(method, *args, &block) end |
Instance Attribute Details
#resource ⇒ Object
Returns the value of attribute resource.
2 3 4 |
# File 'lib/droid_services/decorator.rb', line 2 def resource @resource end |