Class: GameIcons::Finder

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

Instance Method Summary collapse

Instance Method Details

#find(icon) ⇒ Object

Find the icon, possibly without the extension. Raises an error if the icon could not be found.

Examples:

Finder.new.find(‘glass-heart’)



11
12
13
14
15
16
17
# File 'lib/game_icons/finder.rb', line 11

def find(icon)
  str = icon.to_s.downcase
  file = DB.files[str] ||
           DB.files[str.sub(/\.svg$/,'')] ||
           not_found(str, icon)
  Icon.new(file)
end