From: andrew mcelroy Date: 2010-11-07T13:19:40+09:00 Subject: Re: Code in a class but not in a method -- please explain! On Sat, Nov 6, 2010 at 10:22 PM, Bruce F. wrote: > I'm a newcomer to Ruby, and I'm confused about what executable > statements which are in a class definition, but not explicitly in a > method, mean.  How are they executed?  I assume that there's an implicit > method that they define; is that right? > > The most obvious example is the one-line program: > puts "Hello, World!" > > Since there's no explicit class definition, I understand that it's in an > automatically generated class (main).  But, what method of that class is > it in?  And, if it were an explicit class, how would I execute it? > (Apparently it's executed automatically if it's in main.) Checkout DrX http://drx.rubyforge.org/ It might visually show you what's going on. Andrew > > Thanks, > Bruce > > -- > Posted via http://www.ruby-forum.com/. > >