Class: GameIcons::DB
- Inherits:
-
Object
- Object
- GameIcons::DB
- 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
.files ⇒ Object
25 26 27 28 |
# File 'lib/game_icons/db.rb', line 25 def files init @@icons end |
.init ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/game_icons/db.rb', line 7 def init return unless @@icons.empty? icons_dir = '../../resources/icons/ffffff/000000/1x1' resources = File.(icons_dir, File.dirname(__FILE__)) Dir.glob("#{resources}/**/*.svg").each do |svg| name = File.basename(svg,'.svg').downcase #chop off .svg @@icons[name] = svg = svg.sub(resources,'')[%r{/(?<author>\w+)/},"author"] full_name = "#{}/#{name}" # e.g. andymeneely/police-badge @@icons[full_name] = svg end end |
.names ⇒ Object
20 21 22 23 |
# File 'lib/game_icons/db.rb', line 20 def names init @@icons.keys end |