Sha256: 1b13b145a6802f0e63190c7e67ccb5b83cbc789fda7a239b6fe7ad23ecd26f2a
Contents?: true
Size: 508 Bytes
Versions: 1
Compression:
Stored size: 508 Bytes
Contents
require 'nokogiri' module DragonflySvg module Processors class SetAttribute 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dragonfly_svg-1.0.1 | lib/dragonfly_svg/processors/set_attribute.rb |