Ruby File.write

Write to a file, simple and elegant as File.read:

def File.write(file,data)
  File.open(file,'w'){|f|f.write(data)}
end

File.write('xxx',"AAA")
File.write('xxx',File.read('xxx')+"AAA")
...

Leave a comment