Class: GameIcons::DB

Inherits:
Object
  • Object
show all
Defined in:
lib/game_icons/db.rb

Constant Summary collapse

@@icons =

Class-level hash of icon names to their absolute path in this gem

Hash.new

Class Method Summary collapse

Class Method Details

.filesObject



21
22
23
24
# File 'lib/game_icons/db.rb', line 21

def files
  init
  @@icons
end

.initObject



7
8
9
10
11
12
13
14
# File 'lib/game_icons/db.rb', line 7

def init
  return unless @@icons.empty?
  resources = File.expand_path('../../resources', File.dirname(__FILE__))
  Dir.glob("#{resources}/**/*.svg").each do |svg|
    name          = File.basename(svg,'.svg').downcase
    @@icons[name] = svg #chop off .svg

  end
end

.namesObject



16
17
18
19
# File 'lib/game_icons/db.rb', line 16

def names
  init
  @@icons.keys
end