Class: MiniMagick::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/watirsplash/mini_magick_patch.rb

Class Method Summary collapse

Class Method Details

.write(output_to) ⇒ Object

patch to handle paths with spaces in it until new version of MiniMagick gets released.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/watirsplash/mini_magick_patch.rb', line 6

def write(output_to)
  if output_to.kind_of?(String) || !output_to.respond_to?(:write)
    FileUtils.copy_file @path, output_to
    run_command "identify", output_to.to_s.inspect # Verify that we have a good image

  else # stream

    File.open(@path, "rb") do |f|
      f.binmode
      while chunk = f.read(8192)
        output_to.write(chunk)
      end
    end
    output_to
  end
end