Daniel Berger wrote:
> Hi all,
> 
> I'm probably late to the game on this, but I stumbled across an
> interesting use for DATA. You can use it to ensure only one instance
> of a given script is running by using flock:
> 
> class Foo
>    def self.mainloop
>       while true
>          puts "Looping..."
>          sleep 3
>       end
>    end
> end
> 
> DATA.flock(File::LOCK_EX)
I think the above is actually equal to

File.new($0).flock(File::LOCK_EX)


Regards,

Park Heesob
-- 
Posted via http://www.ruby-forum.com/.