Class: Representable::Decorator
- Inherits:
-
Object
- Object
- Representable::Decorator
- Extended by:
- Cloneable, InheritModule
- Includes:
- Representable
- Defined in:
- lib/representable/decorator.rb
Defined Under Namespace
Modules: InheritModule
Constant Summary
Constants included from Representable
Instance Attribute Summary collapse
-
#represented ⇒ Object
(also: #decorated)
readonly
Returns the value of attribute represented.
Class Method Summary collapse
-
.clone ⇒ Object
This is called from inheritable_attr when inheriting a decorator class to a subclass.
- .default_inline_class ⇒ Object
-
.prepare(represented) ⇒ Object
TODO: when moving all class methods into ClassMethods, i get a segfault.
Instance Method Summary collapse
-
#initialize(represented) ⇒ Decorator
constructor
A new instance of Decorator.
Methods included from InheritModule
Methods included from Representable
Constructor Details
#initialize(represented) ⇒ Decorator
Returns a new instance of Decorator.
58 59 60 |
# File 'lib/representable/decorator.rb', line 58 def initialize(represented) @represented = represented end |
Instance Attribute Details
#represented ⇒ Object (readonly) Also known as: decorated
Returns the value of attribute represented.
9 10 11 |
# File 'lib/representable/decorator.rb', line 9 def represented @represented end |
Class Method Details
.clone ⇒ Object
This is called from inheritable_attr when inheriting a decorator class to a subclass. Explicitly subclassing the Decorator makes sure representable_attrs is a clean version.
23 24 25 |
# File 'lib/representable/decorator.rb', line 23 def self.clone Class.new(self) # DISCUSS: why isn't this called by Ruby? end |
.default_inline_class ⇒ Object
17 18 19 |
# File 'lib/representable/decorator.rb', line 17 def self.default_inline_class Representable::Decorator end |
.prepare(represented) ⇒ Object
TODO: when moving all class methods into ClassMethods, i get a segfault.
13 14 15 |
# File 'lib/representable/decorator.rb', line 13 def self.prepare(represented) new(represented) end |