Module: Iconify::Ruby::Helper
- Defined in:
- lib/iconify/ruby/helper.rb
Instance Method Summary collapse
Instance Method Details
#iconify_html_attributes(options) ⇒ Object
21 22 23 24 25 |
# File 'lib/iconify/ruby/helper.rb', line 21 def iconify_html_attributes() attrs = "" .each { |attr, value| attrs += "#{attr}=\"#{value}\" " } attrs.strip end |
#iconify_icon(name, options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/iconify/ruby/helper.rb', line 4 def iconify_icon(name, = {}) locate_name = .delete(:locate) || "bx" = .dup locate = Iconify::Ruby.locate(locate_name) height = locate["height"] width = locate["width"] .merge!({ viewBox: "0 0 #{width} #{height}", version: "1.1", }) path = locate["icons"][name]["body"] "<svg xmlns='http://www.w3.org/2000/svg' #{iconify_html_attributes()}>#{path}</svg>" end |