module Tempfile
Public Class Methods
path(content, dir=Dir.tmpdir)
click to toggle source
Create a temporary file whose contents is CONTENT. Returns the file's path.
# File lib/el4r/el4r-sub.rb, line 147 def path(content, dir=Dir.tmpdir) x = Tempfile.open("content", dir) x.write content x.close x.open x.path end
pathname(content, dir=Dir.tmpdir)
click to toggle source
Similar to Tempfile.path
. But returns Pathname object.
# File lib/el4r/el4r-sub.rb, line 156 def pathname(content, dir=Dir.tmpdir) Pathname.new(path(content, dir=Dir.tmpdir)) end