Class: Representable::Decorator
- Inherits:
-
Object
- Object
- Representable::Decorator
- Includes:
- Representable
- Defined in:
- lib/representable/decorator.rb
Constant Summary collapse
- Coercion =
TODO: deprecate for 1.7.
Representable::Coercion
Constants included from Representable
Instance Attribute Summary collapse
-
#represented ⇒ Object
(also: #decorated)
readonly
Returns the value of attribute represented.
Class Method Summary collapse
-
.inline_representer(base_module, name, options, &block) ⇒ Object
DISCUSS: separate module?.
- .prepare(represented) ⇒ Object
Instance Method Summary collapse
-
#initialize(represented) ⇒ Decorator
constructor
A new instance of Decorator.
Methods included from Representable
Constructor Details
#initialize(represented) ⇒ Decorator
Returns a new instance of Decorator.
19 20 21 |
# File 'lib/representable/decorator.rb', line 19 def initialize(represented) @represented = represented end |
Instance Attribute Details
#represented ⇒ Object (readonly) Also known as: decorated
Returns the value of attribute represented.
3 4 5 |
# File 'lib/representable/decorator.rb', line 3 def represented @represented end |
Class Method Details
.inline_representer(base_module, name, options, &block) ⇒ Object
DISCUSS: separate module?
10 11 12 13 14 15 |
# File 'lib/representable/decorator.rb', line 10 def self.inline_representer(base_module, name, , &block) # DISCUSS: separate module? Class.new(self) do include base_module instance_exec &block end end |
.prepare(represented) ⇒ Object
6 7 8 |
# File 'lib/representable/decorator.rb', line 6 def self.prepare(represented) new(represented) end |