When you execute the interpreter by saying something like ruby file_to_execute.rb it starts to execute Ruby code in the file. In this case it first executes the class definition and then the "invisible main". So actually the main in Ruby is a little bit like in Java. If you write something to top-level it gets executed, but usually it's better to write if __FILE__ == $0 # the contents of main end Which brings me to other subject I've wanted to talk for a while. When shall we see if main # main_program(), the_executed_script(), or_some_other_good_name() # the contents of main end __FILE__ is ugly (gives me feeling of Python), and $0 is uglier (gives me feeling of Perl). There should be the better way (tm). Show me the light. - Aleksi