reopen

ios.reopen(other_IO) â ios
ios.reopen(path, mode_str) â ios
Instance Public methods

Reassociates ios with the I/O stream given in other_IO or to a new stream opened on path. This may dynamically change the actual class of this stream.

f1 = File.new("testfile")
f2 = File.new("testfile")
f2.readlines[0]   #=> "This is line one\n"
f2.reopen(f1)     #=> #<File:testfile>
f2.readlines[0]   #=> "This is line one\n"
doc_ruby_on_rails
2015-04-13 14:00:57
Comments
Leave a Comment

Please login to continue.