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 over 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]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0