Method: Fable::ListDefinitionsOrigin#initialize

Defined in:
lib/fable/list_definitions_origin.rb

#initialize(lists) ⇒ ListDefinitionsOrigin

Returns a new instance of ListDefinitionsOrigin.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fable/list_definitions_origin.rb', line 13

def initialize(lists)
  self._lists = {}
  self.all_unambiguous_list_value_cache = {}

  lists.each do |list|
    self._lists[list.name] = list

    list.items.each do |item, int_value|
      list_value = ListValue.new(item, int_value)

      # May be ambiguous, but compiler should've caught that,
      # so we may be doing some replacement here, but that's okay
      self.all_unambiguous_list_value_cache[item.item_name] = list_value
      self.all_unambiguous_list_value_cache[item.full_name] = list_value
    end
  end
end