From: Gyoung-Yoon Noh Date: 2005-10-31T12:26:26+09:00 Subject: Re: determining whether an object is an immediate? On 10/31/05, Ryan Leavengood wrote: > On 10/30/05, Gyoung-Yoon Noh wrote: > > > > Ouch, except Object: > > > > >> [Object, Fixnum, Symbol, NilClass, FalseClass, TrueClass].each { > > |c| c.instance_eval { define_method(:immediate?) { (Object == self) ? > > false : true } } } > > #=> [Object, Fixnum, Symbol, NilClass, FalseClass, TrueClass] > > >> Fixnum.immediate? > > #=> true > > >> Object.immediate? > > #=> false > > But also: > > irb(main):007:0> 'string'.immediate? > => true > irb(main):008:0> [].immediate? > => true > irb(main):009:0> Array.immediate? > => true > > Yours returns true for everything except Object. The other version I > posted is correct. > > Ryan > > Right. 'self' should not be there. Thanks for correcting. -- http://nohmad.sub-port.net