Sha256: 2f2d6770b77eae62128db6b4652aadcb6a6f0e5a643af6b1fbbf35b050951ee2

Contents?: true

Size: 474 Bytes

Versions: 1

Compression:

Stored size: 474 Bytes

Contents

require 'nokogiri'

module DragonflySvg
  module Processors
    class SetTagValue
      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
    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_tag_value.rb