Class: DragonflySvg::Processors::SetDimensions

Inherits:
Object
  • Object
show all
Defined in:
lib/dragonfly_svg/processors/set_dimensions.rb

Instance Method Summary collapse

Instance Method Details

#call(content, width, height) ⇒ Object

Raises:



6
7
8
9
10
11
12
# 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