ruby中的临时映像文件

amy*_*amy 4 file temp

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

Dut*_*tow 6

检查文档!

  # 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"
Run Code Online (Sandbox Code Playgroud)