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

**URL:** <https://rubytalk.org/t/where-is-the-call-to-tempfile-new-in-this-code/40646>\
**Category:** ruby-talk\
**Created:** [15 September 2007 21:50 UTC](https://rubytalk.org/t/where-is-the-call-to-tempfile-new-in-this-code/40646 "2007-09-15T21:50:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cd\_Cd](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@Cd\_Cd](https://rubytalk.org/u/Cd_Cd)\
**Post date:** [15 September 2007 21:50 UTC](https://rubytalk.org/t/where-is-the-call-to-tempfile-new-in-this-code/40646/1 "2007-09-15T21:50:09Z")

</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  
&nbsp;&nbsp;5.times do |i|  
&nbsp;&nbsp;&nbsp;&nbsp;f.flock File::LOCK\_EX  
&nbsp;&nbsp;&nbsp;&nbsp;f.puts format("%s:%d @ %f\n",who, i, Time.now.to\_f)  
&nbsp;&nbsp;&nbsp;&nbsp;f.flock File::LOCK\_UN  
&nbsp;&nbsp;end  
end

path = format(\_\_FILE\_\_ + '.out')  
fd = open(path, File::WRONLY | File::TRUNC | File::CREAT)

if fork  
&nbsp;&nbsp;compete 'PARENT', fd

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

else  
&nbsp;&nbsp;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?
