In your Ruby app you may actually need to save a temporary file to the hard drive which you should store in your operating systems
/tmp directory. This is because operating systems, usually on reboot, will automatically clear out the
/tmp directory for you. So, it is good practice to use that directory instead of some other one.
irb(main):002:0> Dir.tmpdir => "/tmp"
It is good to use
Dir.tmpdir rather than using
/tmp directly because Windows or possibly some other operating system my use something other than
/tmp, but Ruby’s
Dir.tmpdir will figure this out for you.