0
煥我看着霧文檔在http://fog.io/storage/,例子說:在霧存儲中上傳文件時,不需要關閉ruby文件對象?
# 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
謝謝!我瞭解這一點。 –