Last Updated: February 25, 2016
· proxygear

Ruby Tempfile without Postfix

Everething is explained here :

If you create a Tempfile this way :

f = 'test.png'

You'll get a file name looling like this :

f.path => 'SOMEPATH/test.png20130627-13175-1ejj0w8'

If you don't want the post fix you need to pass an array instead :

f =['text', '.png'] #don't forget the '.'
#=> "SOMEPATH/text20130627-13175-1ejj0w8.png"