From: Stephane Wirtel Date: 2006-11-05T11:40:09+09:00 Subject: Re: how to know if i am in a module or in the main script ? Stephane Wirtel wrote: > Hi all, > > with ruby, it's possible to check if I am in the main script or in a > module with if __name__ == 'main' > > Is there the same thing with ruby ? > > Thanks Here is a way to find if a ruby file is a module or the main script. if $0 == __FILE__ puts "This is the main function" else puts "This is a module" end Is it right ?