From: Philipp Kempgen Date: 2010-08-15T18:37:06+09:00 Subject: Re: kind_of?( NilClass ) David Masover schrieb (am 15.8.10 07:58): > On Saturday, August 14, 2010 03:10:28 pm Philipp Kempgen wrote: >> Steve Klabnik wrote: >> > You can always var.nil? >> >> Well, yes if the var is a kind_of?(Object) but not if >> it's just a BasicObject. > > The purpose of a BasicObject is, generally, to implement proxy classes. > Presumably, this would send a nil? through to whatever you were proxying, > right? > > Also, I don't see a kind_of? on BasicObject, either, so calling pretty much > anything on var would fail. Right. I guess I'll stick with ! var or not var which is what Ryan suggested and which is about twice as fast as any one of ! var.nil?() ! var.eql?(nil) ! nil.eql?(var) ! var.kind_of?(NilClass) Regards, Philipp