Module: FontAwesome5Rails::Parsers::ParseMethods

Included in:
FaIconParser, FaLayeredIconParser, FaStackedIconParser
Defined in:
lib/font_awesome5_rails/parsers/parse_methods.rb

Instance Method Summary collapse

Instance Method Details

#arr_with_fa(array) ⇒ Object



44
45
46
47
# File 'lib/font_awesome5_rails/parsers/parse_methods.rb', line 44

def arr_with_fa(array)
  array = handle_input(array)
  array.split(' ').map { |s| prepend_fa(s) }
end

#icon_type(type) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/font_awesome5_rails/parsers/parse_methods.rb', line 4

def icon_type(type)
  return 'fas' if type.nil?

  case type.to_sym
  when :far, :regular
    'far'
  when :fal, :light
    'fal'
  when :fab, :brand
    'fab'
  when :fad, :duotone
    'fad'
  when :fak, :uploaded
    'fak'
  else
    'fas'
  end
end

#icon_type_path(type) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/font_awesome5_rails/parsers/parse_methods.rb', line 23

def icon_type_path(type)
  return 'solid' if type.nil?

  case type.to_sym
  when :far, :regular
    'regular'
  when :fal, :light
    'light'
  when :fab, :brand
    'brands'
  when :fad, :duotone
    'duotone'
  else
    'solid'
  end
end

#prepend_fa(string) ⇒ Object



40
41
42
# File 'lib/font_awesome5_rails/parsers/parse_methods.rb', line 40

def prepend_fa(string)
  "fa-#{string}"
end