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:#<Class:0xb7dfae50>> > [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? It works as described ModuleName.ancestors returns an array including itself and its ancestors. irb(main):034:0> Array.ancestors => [Array, Enumerable, Object, Kernel] irb(main):035:0> Class.ancestors => [Class, Module, Object, Kernel] Perhaps it does blur the lines of the term module Module Mod Module is the Class Name that recent versions of Ruby respond to, Mod is apparently an old synonym that is still in the Rdoc, but Ruby doesn't recognize it, it could be a mistake in the docs, but it could also be an old alias... irb(main):036:0> Mod.ancestors NameError: uninitialized constant Mod from (irb):36 from :0 irb(main):037:0> Module.ancestors => [Module, Object, Kernel]