module FontAwesome5Rails::Parsers::ParseMethods

Public Instance Methods

arr_with_fa(array) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/font_awesome5_rails/parsers/parse_methods.rb, line 40
def prepend_fa(string)
  "fa-#{string}"
end

Private Instance Methods

handle_input(input) click to toggle source
# File lib/font_awesome5_rails/parsers/parse_methods.rb, line 51
def handle_input(input)
  case input
  when Symbol
    input.to_s.dasherize
  when Array
    input.join(' ').dasherize
  else
    input.to_s
  end
end