Class: SvgOptimizer::Plugins::CleanupAttribute
- Inherits:
-
Base
- Object
- Base
- SvgOptimizer::Plugins::CleanupAttribute
show all
- Defined in:
- lib/svg_optimizer/plugins/cleanup_attribute.rb
Instance Attribute Summary
Attributes inherited from Base
#xml
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#cleanup_attribute(attribute) ⇒ Object
14
15
16
|
# File 'lib/svg_optimizer/plugins/cleanup_attribute.rb', line 14
def cleanup_attribute(attribute)
attribute.value = attribute.value.strip.squeeze(" ")
end
|
#process ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/svg_optimizer/plugins/cleanup_attribute.rb', line 6
def process
xml.xpath("//*[@*]").each do |node|
node.attributes.each do |_, attribute|
cleanup_attribute attribute
end
end
end
|