Class: DragonflySvg::Processors::SetViewBox

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

Instance Method Summary collapse

Instance Method Details

#call(content, min_x, min_y, width, height) ⇒ Object

Raises:



6
7
8
9
10
11
12
# File 'lib/dragonfly_svg/processors/set_view_box.rb', line 6

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