Class: Extentions::Collection

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

Defined Under Namespace

Classes: Presenter

Instance Method Summary collapse

Constructor Details

#initialize(model, extentions) ⇒ Collection

Returns a new instance of Collection.



34
35
36
37
# File 'lib/extentions.rb', line 34

def initialize(model, extentions)
  @extentions = extentions
  @model = model
end

Instance Method Details

#build_presenterObject



45
46
47
48
49
50
# File 'lib/extentions.rb', line 45

def build_presenter
  rendered = extentions.each_with_object({}) do |extention, rendered|
    rendered[extention.to_token] = -> { extention.render }
  end
  Presenter.new(model, rendered)
end

#process!(*params) ⇒ Object



39
40
41
42
43
# File 'lib/extentions.rb', line 39

def process!(*params)
  extentions.each do |extention|
    extention.process(*params)
  end
end