From: Peter Hickman Date: 2006-02-22T00:23:12+09:00 Subject: Re: FILE test You will see this sort of thing in other scripting languages. __FILE__ contains the name of the file source file and $0 is the name of the currently executing script. So a file called hello.rb class Hello def initialize(name) @name = name end def greet puts "Hello #{@name}" end end if __FILE__ == $0 then h = Hello.new('World') h.greet end you can then run this file with ruby hello.rb which will run the code at the bottom. However with tom.rb require 'hello' h = Hello.new('tom') h.greet when you run tom.rb the __FILE__ == $0 part of hello does not run as the file hello.rb but the currently executing script is tom.rb. This allows you to have a ruby file hold the class for inclusion by other scripts and also be a utility script in it's own right.