class SvgOptimizer::Plugins::RemoveEmptyAttribute
Public Instance Methods
process()
click to toggle source
# File lib/svg_optimizer/plugins/remove_empty_attribute.rb, line 6 def process xml.xpath("//*[@*='']").each do |node| node.attributes.each do |name, _| remove_if_empty node, name end end end
Private Instance Methods
remove_if_empty(node, attr)
click to toggle source
# File lib/svg_optimizer/plugins/remove_empty_attribute.rb, line 16 def remove_if_empty(node, attr) node.remove_attribute(attr) if node[attr].empty? end