Project

General

Profile

Bug #12345

A module's private constants are given with `Module#constant(false)`

Added by sawa (Tsuyoshi Sawada) about 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:75338]

Description

A module's private constants are given with Module#constant(false).

module A
  X = 1
  Y = 2
  private_constant :Y
end

module B
  Z = 3
  W = 4
  private_constant :W
end

A.constants        # => [:X]
A.constants(false) # => [:X, :Y]

A.include B
A.constants        # => [:X, :Z]
A.constants(false) # => [:X, :Y]

Besides this, I request a way to get the private constants of a module. I want:


A.private_constants        # => [:Y]
A.private_constants(false) # => [:Y]

A.include B
A.private_constants        # => [:Y, :W]
A.private_constants(false) # => [:Y]

Associated revisions

Revision 6ea002a7
Added by nobu (Nobuyoshi Nakada) almost 3 years ago

variable.c: exclude private constants

  • variable.c (rb_local_constants_i): exclude private constants when excluding inherited constants too. [Bug #12345]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 55705
Added by nobu (Nobuyoshi Nakada) almost 3 years ago

variable.c: exclude private constants

  • variable.c (rb_local_constants_i): exclude private constants when excluding inherited constants too. [Bug #12345]

Revision 55705
Added by nobu (Nobuyoshi Nakada) almost 3 years ago

variable.c: exclude private constants

  • variable.c (rb_local_constants_i): exclude private constants when excluding inherited constants too. [Bug #12345]

Revision 55705
Added by nobu (Nobuyoshi Nakada) almost 3 years ago

variable.c: exclude private constants

  • variable.c (rb_local_constants_i): exclude private constants when excluding inherited constants too. [Bug #12345]

Revision 55705
Added by nobu (Nobuyoshi Nakada) almost 3 years ago

variable.c: exclude private constants

  • variable.c (rb_local_constants_i): exclude private constants when excluding inherited constants too. [Bug #12345]

Revision 717f31e0
Added by nagachika (Tomoyuki Chikanaga) almost 3 years ago

merge revision(s) 55705: [Backport #12345]

    * variable.c (rb_local_constants_i): exclude private constants
      when excluding inherited constants too.  [Bug #12345]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 55868
Added by nagachika (Tomoyuki Chikanaga) almost 3 years ago

merge revision(s) 55705: [Backport #12345]

* variable.c (rb_local_constants_i): exclude private constants
  when excluding inherited constants too.  [Bug #12345]

Revision caec808f
Added by usa (Usaku NAKAMURA) almost 3 years ago

merge revision(s) 55705: [Backport #12345]

    * variable.c (rb_local_constants_i): exclude private constants
      when excluding inherited constants too.  [Bug #12345]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@55930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 55930
Added by usa (Usaku NAKAMURA) almost 3 years ago

merge revision(s) 55705: [Backport #12345]

* variable.c (rb_local_constants_i): exclude private constants
  when excluding inherited constants too.  [Bug #12345]

History

Updated by nobu (Nobuyoshi Nakada) about 3 years ago

  • Tracker changed from Bug to Feature

Updated by shyouhei (Shyouhei Urabe) about 3 years ago

Report upper half: is a bug, should be fixed.

Updated by nobu (Nobuyoshi Nakada) almost 3 years ago

  • Backport set to 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
  • Tracker changed from Feature to Bug
#4

Updated by nobu (Nobuyoshi Nakada) almost 3 years ago

  • Status changed from Open to Closed

Applied in changeset r55705.


variable.c: exclude private constants

  • variable.c (rb_local_constants_i): exclude private constants when excluding inherited constants too. [Bug #12345]

Updated by usa (Usaku NAKAMURA) almost 3 years ago

  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: WONTFIX, 2.2: REQUIRED, 2.3: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) almost 3 years ago

  • Backport changed from 2.1: WONTFIX, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: WONTFIX, 2.2: REQUIRED, 2.3: DONE

ruby_2_3 r55868 merged revision(s) 55705.

Updated by usa (Usaku NAKAMURA) almost 3 years ago

  • Backport changed from 2.1: WONTFIX, 2.2: REQUIRED, 2.3: DONE to 2.1: WONTFIX, 2.2: DONE, 2.3: DONE

ruby_2_2 r55930 merged revision(s) 55705.

Also available in: Atom PDF