From: Julian Leviston Date: 2008-04-03T16:19:11+09:00 Subject: Re: nested ruby That's a really odd example, Sunil. What are you trying to accomplish? By chaining two methods together, you're calling them both, and ruby is providing you with just this response. if you want to group methods, then you should most likely use a class or a module. Let us know your requirements a little more succinctly and we'll try to provide a nice solution to your problem. Julian. Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO (#2) OUT NOW! http://sensei.zenunit.com/ On 03/04/2008, at 5:45 PM, Sunil Chikkegowda wrote: > Hello All, > > Take a look at this example: > > def method1 > puts 'hello' > def method2 > puts 'world' > end > end > > In IRB, if I say 'method1' it gives 'hello' as output. For > 'method1.method2' it gives 'hello' in first line and 'world' in second > line. > > My question is: Is there any way to print only 'world' if I execute > method1.method2 > -- > Posted via http://www.ruby-forum.com/. >