Class: BiIconParser

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper, ParseMethods
Defined in:
lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ParseMethods

#arr_with_bi, #icon_type, #prepend_bi

Constructor Details

#initialize(icon, options) ⇒ BiIconParser

Returns a new instance of BiIconParser.



9
10
11
12
13
14
15
16
17
18
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 9

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

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



7
8
9
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 7

def attrs
  @attrs
end

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 7

def data
  @data
end

#iconObject (readonly)

Returns the value of attribute icon.



7
8
9
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 7

def icon
  @icon
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 7

def options
  @options
end

#rightObject (readonly)

Returns the value of attribute right.



7
8
9
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 7

def right
  @right
end

#styleObject (readonly)

Returns the value of attribute style.



7
8
9
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 7

def style
  @style
end

#textObject (readonly)

Returns the value of attribute text.



7
8
9
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 7

def text
  @text
end

#titleObject (readonly)

Returns the value of attribute title.



7
8
9
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 7

def title
  @title
end

Instance Method Details

#classesObject



20
21
22
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 20

def classes
  @classes ||= parse_classes
end

#get_content_tagObject



28
29
30
31
32
33
34
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 28

def 
  if @text.nil?
    
  else
    @right ? ( + ) : ( + )
  end
end

#sizesObject



24
25
26
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 24

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