Temporary Ruby Image File

Hi, I would like to know how I can create a temporary file (png) in ruby, because tempfile only gets a random file name, but it does not have an extension file.

+3
source share
1 answer

check documentation

  # 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"
+4
source

Source: https://habr.com/ru/post/1772216/


All Articles