Class: DragonflySvg::Processors::SetNamespace
- Inherits:
-
Object
- Object
- DragonflySvg::Processors::SetNamespace
- Defined in:
- lib/dragonfly_svg/processors/set_namespace.rb
Instance Method Summary collapse
Instance Method Details
#call(content, namespace = "http://www.w3.org/2000/svg") ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dragonfly_svg/processors/set_namespace.rb', line 7 def call content, namespace="http://www.w3.org/2000/svg" doc = Nokogiri::XML(content.data) if svg_node = doc.xpath("//*[name()='svg']").first unless svg_node.namespace.href == namespace doc.remove_namespaces! svg_node.add_namespace(nil, namespace) end end content.update(doc.to_xml) end |