Class: Iron::IconCatalog
- Inherits:
-
Object
- Object
- Iron::IconCatalog
- Defined in:
- app/models/iron/icon_catalog.rb
Class Method Summary collapse
- .all ⇒ Object
- .cache_key ⇒ Object
- .clear_cache! ⇒ Object
- .include?(icon_name) ⇒ Boolean
- .refresh! ⇒ Object
Class Method Details
.all ⇒ Object
4 5 6 |
# File 'app/models/iron/icon_catalog.rb', line 4 def all @cached_icons ||= parse_sprite_icons end |
.cache_key ⇒ Object
21 22 23 24 25 26 |
# File 'app/models/iron/icon_catalog.rb', line 21 def cache_key raise "Icon sprite file not found at #{sprite_file_path}" unless File.exist?(sprite_file_path) mtime = File.mtime(sprite_file_path).to_i "iron/icon_catalog/#{mtime}" end |
.clear_cache! ⇒ Object
8 9 10 |
# File 'app/models/iron/icon_catalog.rb', line 8 def clear_cache! @cached_icons = nil end |
.include?(icon_name) ⇒ Boolean
17 18 19 |
# File 'app/models/iron/icon_catalog.rb', line 17 def include?(icon_name) all.include?(icon_name.to_s) end |
.refresh! ⇒ Object
12 13 14 15 |
# File 'app/models/iron/icon_catalog.rb', line 12 def refresh! clear_cache! all end |