class SvgPathify::Converter
Constants
- CONVERTING_MAP
Attributes
input[R]
Public Class Methods
new( svg )
click to toggle source
# File lib/svg_pathify.rb, line 21 def initialize( svg ) @xml = Nokogiri::XML( svg, &:noblanks ) @converted_root = convert_node @xml.root end
Public Instance Methods
output()
click to toggle source
# File lib/svg_pathify.rb, line 26 def output @converted_root.to_s end
Protected Instance Methods
convert_node( node )
click to toggle source
# File lib/svg_pathify.rb, line 42 def convert_node( node ) return node if node.text? type = CONVERTING_MAP[node.name.to_sym] if type type.new( node ).to_path_element else node.dup.tap do |node| node.children.each do |child| child.swap convert_node( child ) end end end end