On Wed 04 Feb 2004 at 20:05:04 +0900, Artur Merke wrote:

> how do I recognize if a ruby file prg.rb was called as a separate program
> (from the command line) or was just included using require. Testing ARGV
> for being nil doesn't seem to work

if $0 == __FILE__
  # I was called from the command line
else
  # I was 'require'd
end

Ian
-- 
Ian Macdonald               | Anger kills as surely as the other vices. 
System Administrator        | 
ian / caliban.org             | 
http://www.caliban.org      | 
                            |