Module: Pragma::Operation::Decoration::ClassMethods
- Defined in:
- lib/pragma/operation/decoration.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#build_decorator(resource) ⇒ Pragma::Decorator::Base
Builds the decorator for the given resource, using the previously defined decorator class.
-
#decorator(klass) ⇒ Object
Sets the decorator to use for validating this operation.
-
#decorator_klass ⇒ Class
Returns the decorator class.
Instance Method Details
#build_decorator(resource) ⇒ Pragma::Decorator::Base
Builds the decorator for the given resource, using the previously defined decorator class.
Works with both singular resources and collections.
37 38 39 |
# File 'lib/pragma/operation/decoration.rb', line 37 def build_decorator(resource) decorator_klass.represent(resource) end |
#decorator(klass) ⇒ Object
Sets the decorator to use for validating this operation.
17 18 19 |
# File 'lib/pragma/operation/decoration.rb', line 17 def decorator(klass) @decorator = klass end |
#decorator_klass ⇒ Class
Returns the decorator class.
24 25 26 |
# File 'lib/pragma/operation/decoration.rb', line 24 def decorator_klass @decorator end |