如何从我正在使用的 Rails 应用程序写入临时文件(在机器的临时文件夹中)Spreadsheet::Workbook.new
并且我希望将内容写入临时文件
问问题
1233 次
1 回答
3
您可以使用 Ruby 的Tempfile
:
file = Tempfile.new('prefix')
或使用块:
Tempfile.new('prefix') do |file|
# do the work with the file
end
于 2012-08-31T10:56:56.270 回答