class DragonflySvg::Processors::SetViewBox

Public Instance Methods

call(content, min_x, min_y, width, height) click to toggle source
# 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