Sha256: b1b249d44ffd9393ce44e3bd75b90930d6ce1c01c5a37f909036420fe7024b59

Contents?: true

Size: 823 Bytes

Versions: 2

Compression:

Stored size: 823 Bytes

Contents

require_relative 'parse_methods'

class FaIconParser
  include ParseMethods

  attr_reader :icon, :options, :data, :style, :text

  def initialize(icon, options)
    @icon = icon
    @options = options
    @data = options[:data]
    @style = options[:style]
    @text = options[:text]
  end

  def classes
    @classes ||= get_all_classes
  end

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

  private

  def get_all_classes
    tmp = []
    tmp << icon_type(@options[:type])
    tmp << prepend_fa(@icon)
    tmp += @options[:class].split(" ") unless @options[:class].nil?
    tmp += arr_with_fa(@options[:size]) unless @options[:size].nil?
    tmp += arr_with_fa(@options[:animation]) unless @options[:animation].nil?
    tmp.uniq.join(" ").strip
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
font_awesome5_rails-0.2.4 lib/font_awesome5_rails/parsers/fa_icon_parser.rb
font_awesome5_rails-0.2.2 lib/font_awesome5_rails/parsers/fa_icon_parser.rb