07 - writing to a temporary file.rb

来自「O Reilly Ruby Cookbook source code」· RB 代码 · 共 15 行

RB
15
字号
require 'tempfile'out = Tempfile.new("tempfile")out.path                            # => "/tmp/tempfile23786.0"#---out << "Some text."out.rewindout.read                             # => "Some text."out.close#---out = Tempfile.new("myhome_tempfile", "/home/leonardr/temp/")#---require 'fileutils'FileUtils.mv(out.path, "/home/leonardr/old_tempfile")#---

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?