Class: HeroicIcons::Icons
- Inherits:
-
Object
- Object
- HeroicIcons::Icons
- Defined in:
- lib/heroic_icons/heroic_icons.rb
Instance Method Summary collapse
-
#icon(name, **options) ⇒ Object
Updated method signature to accept name and a hash for additional options.
Instance Method Details
#icon(name, **options) ⇒ Object
Updated method signature to accept name and a hash for additional options
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/heroic_icons/heroic_icons.rb', line 9 def icon(name, **) # append or replace? hmmm. [:class] = if [:override_class].present? .delete(:override_class) elsif [:class].present? "#{HeroicIcons.configuration.default_classes} #{[:class]}" else HeroicIcons.configuration.default_classes end file_path = determine_file_path(name, ) begin file_data = File.read(file_path) rescue raise HeroicIcons::IconNotFound, "Icon not found: #{name}" end # Modify SVG with additional attributes if any file_data = modify_svg(file_data, name, ) unless .empty? file_data.html_safe end |