class DragonflySvg::Processors::SetAttribute
Public Instance Methods
call(content, xpath, attribute_name, value)
click to toggle source
# File lib/dragonfly_svg/processors/set_attribute.rb, line 6 def call(content, xpath, attribute_name, value) raise UnsupportedFormat unless content.ext raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase) doc = Nokogiri::XML(content.data) doc.xpath(xpath).each do |node| node.set_attribute attribute_name, value end content.update(doc.to_xml, 'name' => 'temp.svg') end