Class: FontAwesome::Icon
- Inherits:
-
Object
- Object
- FontAwesome::Icon
- Defined in:
- lib/font_awesome/icon.rb
Instance Attribute Summary collapse
-
#font ⇒ Object
readonly
Returns the value of attribute font.
-
#hex_code ⇒ Object
readonly
Returns the value of attribute hex_code.
-
#style ⇒ Object
Returns the value of attribute style.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Icon
constructor
A new instance of Icon.
- #name ⇒ Object
- #to_svg ⇒ Object
- #to_uri ⇒ Object
Constructor Details
Instance Attribute Details
#font ⇒ Object (readonly)
Returns the value of attribute font.
4 5 6 |
# File 'lib/font_awesome/icon.rb', line 4 def font @font end |
#hex_code ⇒ Object (readonly)
Returns the value of attribute hex_code.
4 5 6 |
# File 'lib/font_awesome/icon.rb', line 4 def hex_code @hex_code end |
#style ⇒ Object
Returns the value of attribute style.
3 4 5 |
# File 'lib/font_awesome/icon.rb', line 3 def style @style end |
Class Method Details
Instance Method Details
#name ⇒ Object
12 13 14 |
# File 'lib/font_awesome/icon.rb', line 12 def name hex_code.name end |
#to_svg ⇒ Object
16 17 18 19 20 |
# File 'lib/font_awesome/icon.rb', line 16 def to_svg Nokogiri::XML::Builder.new do |xml| build_svg(xml) end.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION).strip end |
#to_uri ⇒ Object
22 23 24 |
# File 'lib/font_awesome/icon.rb', line 22 def to_uri "data:image/svg+xml,#{URI.escape(to_svg)}" end |