class DragonflySvg::Processors::SetDimensions

Public Instance Methods

call(content, width, height) click to toggle source
# File lib/dragonfly_svg/processors/set_dimensions.rb, line 6
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