How to create a file in Ruby

后端 未结 9 1304
再見小時候
再見小時候 2020-11-28 18:04

I\'m trying to create a new file and things don\'t seem to be working as I expect them too. Here\'s what I\'ve tried:

File.new \"out.txt\"
File.open \"out.tx         


        
9条回答
  •  执笔经年
    2020-11-28 19:03

    If the objective is just to create a file, the most direct way I see is:

     FileUtils.touch "foobar.txt"
    

提交回复
热议问题