Module: Pragma::Operation::Decoration::InstanceMethods
- 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.
-
#decorate(decoratable) ⇒ Pragma::Decorator::Base|Object
If a decorator is defined, acts as an alias for #build_decorator.
Instance Method Details
#build_decorator(resource) ⇒ Pragma::Decorator::Base
Builds the decorator for the given resource, using the previously defined decorator class.
This is just an instance-level alias of #build_decorator. You should use this from inside the operation.
53 54 55 |
# File 'lib/pragma/operation/decoration.rb', line 53 def build_decorator(resource) self.class.build_decorator(resource) end |
#decorate(decoratable) ⇒ Pragma::Decorator::Base|Object
If a decorator is defined, acts as an alias for #build_decorator. If not, simply returns the provided resource.
64 65 66 67 |
# File 'lib/pragma/operation/decoration.rb', line 64 def decorate(decoratable) return decoratable unless self.class.decorator_klass build_decorator(decoratable) end |