Class: Shellfie::SvgRasterWrapper
- Inherits:
-
Object
- Object
- Shellfie::SvgRasterWrapper
- Defined in:
- lib/shellfie/svg_raster_wrapper.rb
Class Method Summary collapse
Class Method Details
.write(output_path) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/shellfie/svg_raster_wrapper.rb', line 9 def write(output_path) temp = Tempfile.new(["shellfie-svg", ".png"], binmode: true) temp.close yield temp.path image = MiniMagick::Image.open(temp.path) File.binwrite(output_path, svg_document(image.width, image.height, File.binread(temp.path))) ensure if temp temp.close unless temp.closed? File.delete(temp.path) if File.exist?(temp.path) end end |