Module: Dota::Utilities::Mapped::ClassMethods

Defined in:
lib/dota/utils/mapped.rb

Instance Method Summary collapse

Instance Method Details

#allObject



23
24
25
# File 'lib/dota/utils/mapped.rb', line 23

def all
  @all ||= mapping.keys.map { |id| new(id) }
end

#mappingObject



15
16
17
18
19
20
21
# File 'lib/dota/utils/mapped.rb', line 15

def mapping
  @mapping ||= begin
    filename = "#{name.split("::").last.downcase}.yml"
    path = File.join(Dota.root, "data", filename)
    YAML.load_file(path).freeze
  end
end