From: "David A. Black" Date: 2008-08-16T03:11:21+09:00 Subject: Re: Ruby: Boolean Challenge Hi -- On Sat, 16 Aug 2008, Emmanuel Oga wrote: > # Paste url: http://gist.github.com/5603 > # Gist Paste Clone URL: git://gist.github.com/5603.git > > # [Impossible?] CHALLENGE: See pending spec at the bottom > # > # PROBLEM: I want to replace statements like this: > # > # puts (OddRecognizer.new.knows?(1) or OddRecognizer.new.knows?(3)) ? > "there are odds" : "there is no odd" > # > # With something like this: > # puts OddRecognizer.new.knows?(1).or?(3) ? "there are odds" : "there > is no odd" > # > # OddRecognizer is just a trivial class just to prove my concept > class OddRecognizer > def knows?(value) > (value % 2) == 0 > end > end Do you mean EvenRecognizer? David -- Rails training from David A. Black and Ruby Power and Light: * Advancing With Rails August 18-21 Edison, NJ * Co-taught by D.A. Black and Erik Kastner See http://www.rubypal.com for details and updates!