# Where is the call to Tempfile.new in this code?

**URL:** <https://www.ruby-forum.com/t/where-is-the-call-to-tempfile-new-in-this-code/114662>\
**Category:** Ruby\
**Created:** [September 17, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/where-is-the-call-to-tempfile-new-in-this-code/114662 "2007-09-17T13:23:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![overworked\_phd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/b5a626/32.png) [@overworked\_phd](https://www.ruby-forum.com/u/overworked_phd)\
**Post date:** [September 17, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/where-is-the-call-to-tempfile-new-in-this-code/114662/1 "2007-09-17T13:23:50Z")

</div>

At the following URL  
[http://groups.google.com/group/comp.lang.ruby/browse\_thread/thread/db1d1d63b26d371/21bba01335a8615c?lnk=gst&q=mandatory+locks&rnum=3#21bba01335a8615c](http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/db1d1d63b26d371/21bba01335a8615c?lnk=gst&q=mandatory+locks&rnum=3#21bba01335a8615c)

There is the following code

#!/usr/local/ruby-1.8.0/bin/ruby  
require ‘ftools’  
require ‘tempfile’

def compete who, f  
5.times do |i|  
f.flock File::LOCK\_EX  
f.puts format(“%s:%d @ %f\n”,who, i, Time.now.to\_f)  
f.flock File::LOCK\_UN  
end  
end

path = format( **FILE** + ‘.out’)  
fd = open(path, File::WRONLY | File::TRUNC | File::CREAT)

if fork  
compete ‘PARENT’, fd

Process.wait rescue nil  
open(path){|f| puts f.read}  
fd.close  
File.rm\_f path if File.exist? path

else  
compete ‘CHILD’, fd  
end

The code runs on my system. But, I don’t see any call to Tempfile.new.  
I’m assuming it’s implied? If it is being implied, where is it being  
implied at in the code?
