Sha256: b512b94b9ffe6bdde13bf30f56b86d65aab829eebdc194e1615e657c08954d60

Contents?: true

Size: 348 Bytes

Versions: 1

Compression:

Stored size: 348 Bytes

Contents

require 'nokogiri'

module DragonflySvg
  module Processors
    class SetAttribute

      def call content, xpath, attribute_name, value
        doc = Nokogiri::XML(content.data)

        doc.xpath(xpath).each do |node|
          node.set_attribute attribute_name, value
        end

        content.update(doc.to_xml)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dragonfly_svg-0.0.3 lib/dragonfly_svg/processors/set_attribute.rb