From: Avi Bryant Date: 2001-10-28T07:06:48+09:00 Subject: [ruby-talk:23649] Re: sleeping, calling methods inside class defs On Sun, 28 Oct 2001, Tobias Reif wrote: > Now I'd like to know why this *does* work: > ----- > def hey > "hey!\n" > end > > print hey > ----- > > Do I define a method for instances of class Object, and when methods are > called, I get an instance of Object for free? I was about to give an explanation about the top level being in the context of the Object class, which is an instance of Class, which is a subclass of Object - but then I actually did this: puts self #=> main puts self.class #=> Object So it appears that the toplevel is implicitly in the context of an instance of Object, except that it also lets you define methods in Object. Which is simpler, if less consistent.