Project

General

Profile

Actions

Bug #12389

closed

Module#constants includes non-constants

Added by rbjl (Jan Lelis) almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
[ruby-core:75575]

Description

Hi Ruby Core,

I noticed that Module#constants(false) sometimes includes modules/classes with a lowercase name:

Complex.constants # => [:I]
Complex.constants(false) # => [:compatible, :I]
Complex.const_defined? :compatible # NameError: wrong constant name compatible

NameError.constants # => []
NameError.constants(false) # => [:message]

Also:

  • Rational --> compatible
  • IO --> generic_readable
  • IO --> generic_writable
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0