Sha256: 0bf48b47713e37a4a6323ffaea02e896ceecb7fed86521658122c381002fa2d0
Contents?: true
Size: 436 Bytes
Versions: 3
Compression:
Stored size: 436 Bytes
Contents
require 'nokogiri' module DragonflySvg module Processors class SetDimensions def call content, width, height doc = Nokogiri::XML(content.data) if svg_node = doc.xpath("//*[name()='svg']").first svg_node.set_attribute 'width', width unless width.nil? svg_node.set_attribute 'height', height unless height.nil? end content.update(doc.to_xml) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems