Module: FontawesomeSubsetter::IconHelper

Defined in:
lib/fontawesome_subsetter/icon_helper.rb

Instance Method Summary collapse

Instance Method Details

#icon(style, name, text = nil, html_options = {}, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fontawesome_subsetter/icon_helper.rb', line 5

def icon(style, name, text = nil, html_options = {}, &block)
  text, html_options = nil, text if text.is_a?(Hash)

  html_options[:class] = "#{ style } fa-#{ name.to_s.dasherize }#{ " #{ html_options[:class] }" if html_options.key? :class }"

  html =  :i, nil, html_options

  html = "#{ html } #{ text }" if text.present?

  html = "#{ html } #{ capture block }" if block_given?

  html.html_safe
end