From: Robert Dober Date: 2007-06-17T00:43:06+09:00 Subject: Re: Error in ancestor? On 6/16/07, John Joyce wrote: > > On Jun 16, 2007, at 8:56 AM, Robert Dober wrote: > > > Hi list > > > > I just observed this (and it cost me quite some effort to debug my > > code :( ) > > > > 515/15 > ruby -ve 'class << Class::new; puts self; puts > > ancestors.inspect end' > > ruby 1.8.5 (2006-12-04 patchlevel 2) [i686-linux] > > #> > > [Class, Module, Object, Kernel] > > > > > > this seems to be in contradiction with > > http://www.ruby-doc.org/core/classes/Module.html#M001700 > > stating > > ---------------------------------------------------------------------- > > ------- > > mod.ancestors → array > > > > Returns a list of modules included in mod (including mod itself). > > > > ============= > > > > module Mod > > include Math > > include Comparable > > end > > > > Mod.ancestors #=> [Mod, Comparable, Math] > > Math.ancestors #=> [Math] > > ---------------------------------------------------------------------- > > ----- > > > > Is this an error in doc or in behavior? > > > > Cheers > > Robert > > > > > > -- > > You see things; and you say Why? > > But I dream things that never were; and I say Why not? > > -- George Bernard Shaw > > > What error? This error ruby -ve 'class << Class::new; puts ancestors.include?( self ) end' ruby 1.8.5 (2006-12-04 patchlevel 2) [i686-linux] false Robert