Module: Aperitiiif::Items

Included in:
Batch
Defined in:
lib/aperitiiif/batch/items.rb

Overview

TO DO COMMENT

Instance Method Summary collapse

Instance Method Details

#itemsObject



9
10
11
# File 'lib/aperitiiif/batch/items.rb', line 9

def items
  @items ||= items_from_assets
end

#items=(items) ⇒ Object



13
14
15
# File 'lib/aperitiiif/batch/items.rb', line 13

def items=(items)
  @items = items
end

#items_from_assets(assets = self.assets) ⇒ Object



17
18
19
20
21
22
# File 'lib/aperitiiif/batch/items.rb', line 17

def items_from_assets(assets = self.assets)
  grouped = assets.group_by(&:parent_id)
  grouped.flat_map do |id, grouped_assets|
    Item.new id, grouped_assets, config
  end
end