Use file.write for ruby 2.0.0