File ruby中的临时图像文件

File ruby中的临时图像文件,file,temp,File,Temp,您好,我想知道如何在ruby中创建临时文件映像(png),因为tempfile只获取一个随机文件名,但没有扩展名文件。 # Use the Array form to enforce an extension in the filename: file = Tempfile.new(['hello', '.jpg']) file.path # => something like: "/tmp/foo2843-8392-92849382--0.jpg"

您好,我想知道如何在ruby中创建临时文件映像(png),因为tempfile只获取一个随机文件名,但没有扩展名文件。

  # Use the Array form to enforce an extension in the filename:
  file = Tempfile.new(['hello', '.jpg'])
  file.path  # => something like: "/tmp/foo2843-8392-92849382--0.jpg"