Sha256: 04534cbbfaea613bd513904a235e9c9a684e511bd77bb1db05bd61095d22d9b2
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true require 'railsstrap/classes/base' module Railsstrap module Classes # @api private class Icon < Base # @return [#to_s] the class to assign to the icon based on the Vector # Icon library used. If not defined here pass through what was provided. def library_class Icon.libraries[@options[:library].to_s.underscore] || @options[:library] end # @return [#to_s] the class to assign to the icon based on the name # of the icon. def name_class return "fa-#{@options[:name].to_s.gsub '_', '-'}" if %i[fas far fab fal].include? library_class "#{library_class}-#{@options[:name].to_s.gsub '_', '-'}" end # @return [#to_s] the icon html tag to use def tag @options[:tag] || :i end # @return [Hash<Symbol, String>] the classes that Bootstrap requires to # append to icons for each possible vector icon library. def self.libraries HashWithIndifferentAccess.new(nil).tap do |klass| klass[:font_awesome] = :'fas' klass[:fas] = :'fas' # font awesome solid klass[:far] = :'far' # font awesome regular klass[:fal] = :'fal' # font awesome light klass[:fal] = :'fab' # font awesome brands klass[:glyphicons] = :'glyphicon' klass[:''] = :'far' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
railsstrap-4.0.0.beta3 | lib/railsstrap/classes/icon.rb |