Project

General

Profile

Actions

Feature #8035

closed

singleton class should be included in ancestors

Added by marcandre (Marc-Andre Lafortune) about 11 years ago. Updated about 11 years ago.

Status:
Closed
Target version:
[ruby-core:53171]

Description

I feel it would be consistent if:

k.ancestors.include?(k) #=> always true if k.is_a?(Class)

This is currently the case except for singleton classes:

class << ""; include Enumerable; end.ancestors
# => [Enumerable, String, Comparable, Object, Kernel, BasicObject]
# would be more consistent:
# => [#<Class:#<String:0x0000010113d268>>, Enumerable, String, Comparable, Object, Kernel, BasicObject]

Note that the singleton classes do appear in the ancestors if a module is instead prepended:

class << ""; prepend Enumerable; end.ancestors
# => [Enumerable, #<Class:#<String:0x0000010113d268>>, String, Comparable, Object, Kernel, BasicObject]

Thanks


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #8166: Since r39628 rspec-mock's and_call_original fail with SystemStackErrorRejectednagachika (Tomoyuki Chikanaga)03/27/2013Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0