Class: Gleborator::BaseDecorator
- Inherits:
-
Object
- Object
- Gleborator::BaseDecorator
- Defined in:
- lib/gleborator/base_decorator.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
(also: #model, #source, #to_source)
readonly
Returns the value of attribute object.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(object) ⇒ BaseDecorator
constructor
A new instance of BaseDecorator.
Constructor Details
#initialize(object) ⇒ BaseDecorator
Returns a new instance of BaseDecorator.
8 9 10 |
# File 'lib/gleborator/base_decorator.rb', line 8 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly) Also known as: model, source, to_source
Returns the value of attribute object.
3 4 5 |
# File 'lib/gleborator/base_decorator.rb', line 3 def object @object end |
Class Method Details
.decorate_collection(collection) ⇒ Object
12 13 14 |
# File 'lib/gleborator/base_decorator.rb', line 12 def self.decorate_collection(collection) collection.map {|object| new(object) } end |
.delegate(*methods) ⇒ Object
16 17 18 19 |
# File 'lib/gleborator/base_decorator.rb', line 16 def self.delegate(*methods) = methods. super *methods, .reverse_merge(to: :object) end |