I mean, I wouldn't normally expect that IO.copy_stream would rewind the destination, but MRI does it, and we're currently relying on that behaviour in Refile (although we will add the rewind now). Just to help you to be the closest to MRI :)
# MRI 2.2.0
require "stringio"
require "tempfile"
file = Tempfile.new('foo')
IO.copy_stream(StringIO.new('foo'), file)
file.eof? #=> false (it's on the beginning)
# JRuby 9.0.0.0.pre1
require "stringio"
require "tempfile"
file = Tempfile.new('foo')
IO.copy_stream(StringIO.new('foo'), file)
file.eof? #=> true
I mean, I wouldn't normally expect that
IO.copy_streamwould rewind the destination, but MRI does it, and we're currently relying on that behaviour in Refile (although we will add the rewind now). Just to help you to be the closest to MRI :)