Class: Promethee::Data::MastersMultiple

Inherits:
Promethee::Data show all
Defined in:
lib/promethee/data/masters_multiple.rb

Overview

List of master version and other localizations, flattened

Instance Method Summary collapse

Methods inherited from Promethee::Data

#[], #data, #include?, #to_json

Constructor Details

#initialize(master, localizations = nil) ⇒ MastersMultiple

Returns a new instance of MastersMultiple.



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/promethee/data/masters_multiple.rb', line 3

def initialize(master, localizations = nil)
  @data = []
  @master = Master.new master
  title = 'Master'
  components = @master.flat
  add_data title, components
  localizations.each do |key, value|
    title = key
    components = Localization.new(value, master).data[:components]
    add_data title, components
  end unless localizations.nil?
end