Bug #6658

Module#ancestors & prepend

Added by Marc-Andre Lafortune almost 3 years ago. Updated almost 3 years ago.

[ruby-core:45919]
Status:Closed
Priority:Normal
Assignee:-
ruby -v:r36240 Backport:

Description

Wouldn't it be best if Module#ancestors returned the modules & classes in the order they will be looked at?

Currently:

module M; end
class C; prepend M; end
C.ancestors # => [C, M, Class, Object, Kernel, BasicObject]
 # even though actual lookup order is [M, C, Class, Object, Kernel, BasicObject]

Related issues

Duplicated by Ruby trunk - Bug #6659: prepend した Class/Module の ancestors に Class が混入する Rejected 06/28/2012

Associated revisions

Revision 36241
Added by Nobuyoshi Nakada almost 3 years ago

prepend: fix ancestors order

  • class.c (rb_mod_ancestors): fix ancestors order. [Bug #6658] [Bug #6659]

Revision 36241
Added by Nobuyoshi Nakada almost 3 years ago

prepend: fix ancestors order

  • class.c (rb_mod_ancestors): fix ancestors order. [Bug #6658] [Bug #6659]

History

#1 Updated by Nobuyoshi Nakada almost 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r36241.
Marc-Andre, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


prepend: fix ancestors order

  • class.c (rb_mod_ancestors): fix ancestors order. [Bug #6658] [Bug #6659]

Also available in: Atom PDF