Class: SimplyInlineSvg::Svg
- Inherits:
-
Object
- Object
- SimplyInlineSvg::Svg
- Defined in:
- lib/simply_inline_svg/svg.rb
Instance Method Summary collapse
- #[](attr_name) ⇒ Object
- #[]=(attr_name, attr_value) ⇒ Object
- #dup ⇒ Object
-
#initialize(str_svg) ⇒ Svg
constructor
A new instance of Svg.
- #render(options = {}) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Method Details
#[](attr_name) ⇒ Object
15 16 17 |
# File 'lib/simply_inline_svg/svg.rb', line 15 def [](attr_name) @svg_attributes[attr_name.to_s] end |
#[]=(attr_name, attr_value) ⇒ Object
11 12 13 |
# File 'lib/simply_inline_svg/svg.rb', line 11 def []=(attr_name, attr_value) @svg_attributes[attr_name.to_s] = attr_value.to_s end |
#dup ⇒ Object
19 20 21 |
# File 'lib/simply_inline_svg/svg.rb', line 19 def dup self.class.new(@doc.to_s) end |
#render(options = {}) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/simply_inline_svg/svg.rb', line 27 def render( = {}) return self.to_s if .empty? cloned_svg = self.dup .each { |k, v| cloned_svg[k] = v } cloned_svg.to_s end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/simply_inline_svg/svg.rb', line 23 def to_s @doc.to_s end |