Class: BiIconParser
- Inherits:
-
Object
- Object
- BiIconParser
- Includes:
- ActionView::Helpers::TagHelper, ParseMethods
- Defined in:
- lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #classes ⇒ Object
- #get_content_tag ⇒ Object
-
#initialize(icon, options) ⇒ BiIconParser
constructor
A new instance of BiIconParser.
- #sizes ⇒ Object
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, ) @icon = icon @options = @data = [:data] @style = [:style] @text = [:text] @title = [:title] @right = [:right] == true @attrs = .except(:text, :class, :icon, :size, :right) end |
Instance Attribute Details
#attrs ⇒ Object (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 |
#data ⇒ Object (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 |
#icon ⇒ Object (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 |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 7 def @options end |
#right ⇒ Object (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 |
#style ⇒ Object (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 |
#text ⇒ Object (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 |
#title ⇒ Object (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
#classes ⇒ Object
20 21 22 |
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 20 def classes @classes ||= parse_classes end |
#get_content_tag ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/bootstrap_icons_rails/parsers/bi_icon_parser.rb', line 28 def get_content_tag if @text.nil? icon_content_tag else @right ? (text_content_tag + icon_content_tag) : (icon_content_tag + text_content_tag) end end |
#sizes ⇒ Object
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 |