Sha256: 06ce563fcef31456090bdb72a061ed44d85918b7268c543f3ed65289e0dc3e25

Contents?: true

Size: 464 Bytes

Versions: 1

Compression:

Stored size: 464 Bytes

Contents

require 'nokogiri'

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

        SetAttribute.new.call(content, "//*[name()='svg']", 'width', width) if width
        SetAttribute.new.call(content, "//*[name()='svg']", 'height', height) if height
      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_dimensions.rb