Sha256: 84dc6f30a3443605d5d98d5566cd3011c3c13046e4d28743d74f509622527a20

Contents?: true

Size: 448 Bytes

Versions: 1

Compression:

Stored size: 448 Bytes

Contents

require 'nokogiri'

module DragonflySvg
  module Processors
    class SetViewBox
      def call(content, min_x, min_y, width, height)
        raise UnsupportedFormat unless content.ext
        raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)

        value = [min_x, min_y, width, height].map(&:to_s).join(' ')
        SetAttribute.new.call(content, "//*[name()='svg']", 'viewBox', value)
      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_view_box.rb