Class: FaIconParser

Inherits:
Object
  • Object
show all
Includes:
ParseMethods
Defined in:
lib/font_awesome5_rails/parsers/fa_icon_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ParseMethods

#arr_with_fa, #icon_type, #prepend_fa

Constructor Details

#initialize(icon, options) ⇒ FaIconParser

Returns a new instance of FaIconParser.



8
9
10
11
12
13
14
15
16
# File 'lib/font_awesome5_rails/parsers/fa_icon_parser.rb', line 8

def initialize(icon, options)
  @icon = icon
  @options = options
  @data = options[:data]
  @style = options[:style]
  @text = options[:text]
  @title = options[:title]
  @attrs = options.except(:text, :type, :class, :icon, :animation, :size)
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



6
7
8
# File 'lib/font_awesome5_rails/parsers/fa_icon_parser.rb', line 6

def attrs
  @attrs
end

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/font_awesome5_rails/parsers/fa_icon_parser.rb', line 6

def data
  @data
end

#iconObject (readonly)

Returns the value of attribute icon.



6
7
8
# File 'lib/font_awesome5_rails/parsers/fa_icon_parser.rb', line 6

def icon
  @icon
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/font_awesome5_rails/parsers/fa_icon_parser.rb', line 6

def options
  @options
end

#styleObject (readonly)

Returns the value of attribute style.



6
7
8
# File 'lib/font_awesome5_rails/parsers/fa_icon_parser.rb', line 6

def style
  @style
end

#textObject (readonly)

Returns the value of attribute text.



6
7
8
# File 'lib/font_awesome5_rails/parsers/fa_icon_parser.rb', line 6

def text
  @text
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/font_awesome5_rails/parsers/fa_icon_parser.rb', line 6

def title
  @title
end

Instance Method Details

#classesObject



18
19
20
# File 'lib/font_awesome5_rails/parsers/fa_icon_parser.rb', line 18

def classes
  @classes ||= get_all_classes
end

#sizesObject



22
23
24
# File 'lib/font_awesome5_rails/parsers/fa_icon_parser.rb', line 22

def sizes
  @sizes ||= @options[:size].nil? ? "" : arr_with_fa(@options[:size]).uniq.join(" ").strip
end