Class: InlineSVG
- Inherits:
-
Object
- Object
- InlineSVG
- Defined in:
- lib/middleman-inline_svg/inline_svg.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(file, options = {}) ⇒ InlineSVG
constructor
A new instance of InlineSVG.
- #to_html ⇒ Object
Constructor Details
#initialize(file, options = {}) ⇒ InlineSVG
Returns a new instance of InlineSVG.
6 7 8 9 10 |
# File 'lib/middleman-inline_svg/inline_svg.rb', line 6 def initialize(file, = {}) @file = file @title = .delete(:title) = end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
4 5 6 |
# File 'lib/middleman-inline_svg/inline_svg.rb', line 4 def file @file end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/middleman-inline_svg/inline_svg.rb', line 4 def end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/middleman-inline_svg/inline_svg.rb', line 4 def title @title end |
Instance Method Details
#to_html ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/middleman-inline_svg/inline_svg.rb', line 12 def to_html doc = asset_doc(file) svg = doc.at_css("svg") if title add_title(doc, svg, title) end .each do |key, value| svg[key.to_s.tr("_", "-")] = value end doc.to_html end |