Sha256: 0ecc5f8cd59b7875b59fff05ca965f9dc71ce47c327aaeec72e970bb9ba82cc3

Contents?: true

Size: 380 Bytes

Versions: 3

Compression:

Stored size: 380 Bytes

Contents

require 'nokogiri'

module DragonflySvg
  module Processors
    class SetPreserveAspectRatio

      def call content, value='xMinYMin meet'
        doc = Nokogiri::XML(content.data)

        if svg_node = doc.xpath("//*[name()='svg']").first
          svg_node.set_attribute 'preserveAspectRatio', value
        end

        content.update(doc.to_xml)
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dragonfly_svg-0.0.3 lib/dragonfly_svg/processors/set_preserve_aspect_ratio.rb
dragonfly_svg-0.0.2 lib/dragonfly_svg/processors/set_preserve_aspect_ratio.rb
dragonfly_svg-0.0.1 lib/dragonfly_svg/processors/set_preserve_aspect_ratio.rb