【发布时间】:2017-04-12 07:08:27
【问题描述】:
当我查看 http://fog.io/storage/ 的 Fog 文档时,示例显示:
# upload that resume
file = directory.files.create(
:key => 'resume.html',
:body => File.open("/path/to/my/resume.html"),
:public => true
)
File.open(...) 返回文件对象,但我想知道它什么时候关闭?下面的资源比较保守还是没关系?:
# upload that resume
File.open("/path/to/my/resume.html") do |f|
file = directory.files.create(
:key => 'resume.html',
:body => f,
:public => true
)
end
【问题讨论】:
标签: fog