Class: FontAwesomeHelper::FaIcon

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/font-awesome-helper/fa_icon.rb

Constant Summary collapse

FA_CLASS_PREFIX =
'fa'

Instance Method Summary collapse

Constructor Details

#initialize(names, options = {}) ⇒ FaIcon

Returns a new instance of FaIcon.



6
7
8
9
10
# File 'lib/font-awesome-helper/fa_icon.rb', line 6

def initialize(names, options = {})
  @classes = [FA_CLASS_PREFIX]
  @classes.concat fa_prefixize(names_to_a(names))
  @classes.concat names_to_a(options.delete(:class))
end

Instance Method Details

#to_tagObject



12
13
14
# File 'lib/font-awesome-helper/fa_icon.rb', line 12

def to_tag
  (:i, nil, class: @classes.join(' '))
end