1 2 3 4 5 6 7 8 |
open("/tmp/A", "w") {|io| io << 'foo' }
open("/tmp/B", "w") {|io| io << 'bar' }
FileUtils.mv("/tmp/A", "/tmp/B")
open("/tmp/B", "r") {|io| io.read } # => "foo"
|
Pastie
Support Pastie
or read my
Pastie << self
blog
1 2 3 4 5 6 7 8 |
open("/tmp/A", "w") {|io| io << 'foo' }
open("/tmp/B", "w") {|io| io << 'bar' }
FileUtils.mv("/tmp/A", "/tmp/B")
open("/tmp/B", "r") {|io| io.read } # => "foo"
|