class Fable::ListDefinitionsOrigin

Attributes

_lists[RW]
all_unambiguous_list_value_cache[RW]

Public Class Methods

new(lists) click to toggle source
# 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

Public Instance Methods

find_list(name) click to toggle source
# File lib/fable/list_definitions_origin.rb, line 9
def find_list(name)
  self._lists[name]
end
find_single_item_list_with_name(name) click to toggle source
# File lib/fable/list_definitions_origin.rb, line 31
def find_single_item_list_with_name(name)
  return all_unambiguous_list_value_cache[name]
end
lists() click to toggle source
# File lib/fable/list_definitions_origin.rb, line 5
def lists
  self._lists.map{|k,v| v}
end