From: Gennady Bystritsky Date: 2010-04-01T01:07:35+09:00 Subject: Re: Ruby Koans: will this method ever return :empty? On Mar 31, 2010, at 8:57 AM, Gennady Bystritsky wrote: > > On Mar 31, 2010, at 8:36 AM, sl4m wrote: > >> Thanks guys! It looks like there's a mistake in the koans then. I'll >> report it to the author. I ran this piece of code over and over on irb, but >> could not figure it out. > > Wasn't that the idea behind "koans"? I haven't heard about them until your post, however according to http://brandon.dimcheff.com/2009/02/05/how-to-learn-ruby.html: Darn, looks like ":" becomes the part of URL when you click the above link. Try just this: http://brandon.dimcheff.com/2009/02/05/how-to-learn-ruby.html > > "... The Koans are essentially a series of failing test cases that you need to figure out how to fix in order to move on to the next step." > > From that, my understanding is that a user is supposed to find problems in "koans" and fix them. You found one, good going ;-) > > Regards, > Gennady. > >> >> >> Cheers, >> skim >> >> On Wed, Mar 31, 2010 at 05:23, Aldric Giacomoni wrote: >> >>> Aldric Giacomoni wrote: >>>> Steve Kim wrote: >>> >>>>> Is it possible to have this method return :empty? >>> >>>> >>>> class MessageCatcher >>>> def add_a_payload *args >>>> args.empty? :empty : args >>>> end >>>> end >>>> >>>> args.empty? [:empty] : args >>>> >>> >>> I'd appreciate it if no one mentioned that I forgot the '?' twice! I am >>> so ashamed. >>> >>> args.empty? ? :empty : args >>> args.empty? ? [:empty] : args >>> -- >>> Posted via http://www.ruby-forum.com/. >>> >>> > >