class SimplyInlineSvg::Svg
Public Class Methods
new(str_svg)
click to toggle source
# File lib/simply_inline_svg/svg.rb, line 6 def initialize(str_svg) @doc = XML::Parser.string(str_svg).parse @svg_attributes = @doc.root.attributes end
Public Instance Methods
[](attr_name)
click to toggle source
# File lib/simply_inline_svg/svg.rb, line 15 def [](attr_name) @svg_attributes[attr_name.to_s] end
[]=(attr_name, attr_value)
click to toggle source
# 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()
click to toggle source
# File lib/simply_inline_svg/svg.rb, line 19 def dup self.class.new(@doc.to_s) end
render(options = {})
click to toggle source
# File lib/simply_inline_svg/svg.rb, line 27 def render(options = {}) return self.to_s if options.empty? cloned_svg = self.dup options.each { |k, v| cloned_svg[k] = v } cloned_svg.to_s end
to_s()
click to toggle source
# File lib/simply_inline_svg/svg.rb, line 23 def to_s @doc.to_s end