Class: Representable::Decorator
- Inherits:
-
Object
- Object
- Representable::Decorator
- Includes:
- Representable
- Defined in:
- lib/representable/decorator.rb
Constant Summary
Constants included from Representable
Instance Attribute Summary collapse
-
#represented ⇒ Object
readonly
Returns the value of attribute represented.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(represented) ⇒ Decorator
constructor
A new instance of Decorator.
- #representable_binding_for(attr, format, options) ⇒ Object
Methods included from Representable
included, #update_properties_from
Constructor Details
#initialize(represented) ⇒ Decorator
Returns a new instance of Decorator.
11 12 13 |
# File 'lib/representable/decorator.rb', line 11 def initialize(represented) @represented = represented end |
Instance Attribute Details
#represented ⇒ Object (readonly)
Returns the value of attribute represented.
3 4 5 |
# File 'lib/representable/decorator.rb', line 3 def represented @represented end |
Class Method Details
.prepare(represented) ⇒ Object
5 6 7 |
# File 'lib/representable/decorator.rb', line 5 def self.prepare(represented) new(represented) # was: PrepareStrategy::Decorate. end |
Instance Method Details
#representable_binding_for(attr, format, options) ⇒ Object
15 16 17 18 19 |
# File 'lib/representable/decorator.rb', line 15 def representable_binding_for(attr, format, ) context = attr.[:representer_exec] ? self : represented # DISCUSS: should Decorator know this kinda stuff? format.build(attr, represented, , context) end |