Project

General

Profile

Actions

Bug #12345

closed

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

Added by sawa (Tsuyoshi Sawada) over 8 years ago. Updated about 8 years ago.

Status:
Closed
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]

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Tracker changed from Bug to Feature

Updated by shyouhei (Shyouhei Urabe) over 8 years ago

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

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

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

Updated by nobu (Nobuyoshi Nakada) over 8 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) about 8 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) about 8 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) about 8 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0