Class: Cyrax::Decorator
- Inherits:
-
Wrapper
show all
- Includes:
- ActiveModel::Serialization, ActiveModel::Serializers::JSON, ActiveModel::Serializers::Xml
- Defined in:
- lib/cyrax/decorator.rb
Instance Attribute Summary
Attributes inherited from Wrapper
#accessor, #options, #resource
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Wrapper
#initialize
Constructor Details
This class inherits a constructor from Cyrax::Wrapper
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
19
20
21
22
|
# File 'lib/cyrax/decorator.rb', line 19
def method_missing(method, *args, &block)
return super unless resource.respond_to?(method)
resource.send(method, *args, &block)
end
|
Class Method Details
.decorate_collection(resource) ⇒ Object
Instance Method Details
#to_model ⇒ Object
7
8
9
|
# File 'lib/cyrax/decorator.rb', line 7
def to_model
resource
end
|
#to_param ⇒ Object
11
12
13
|
# File 'lib/cyrax/decorator.rb', line 11
def to_param
resource.to_param
end
|
#to_partial_path ⇒ Object
15
16
17
|
# File 'lib/cyrax/decorator.rb', line 15
def to_partial_path
resource.to_partial_path
end
|