class DragonflySvg::Processors::SetTagValue

Public Instance Methods

call(content, xpath, value) click to toggle source
# File lib/dragonfly_svg/processors/set_tag_value.rb, line 6
def call(content, xpath, 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.inner_html = value
  end

  content.update(doc.to_xml, 'name' => 'temp.svg')
end