Class: Gleborator::BaseDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/gleborator/base_decorator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#objectObject (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)
  options = methods.extract_options!
  super *methods, options.reverse_merge(to: :object)
end