[ruby-core:76917] [Ruby trunk Bug#12345] A module's private constants are given with `Module#constant(false)`
From:
usa@...
Date:
2016-08-16 05:56:29 UTC
List:
ruby-core #76917
Issue #12345 has been updated by Usaku NAKAMURA. 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. ---------------------------------------- Bug #12345: A module's private constants are given with `Module#constant(false)` https://bugs.ruby-lang.org/issues/12345#change-60148 * Author: Tsuyoshi Sawada * Status: Closed * Priority: Normal * Assignee: * ruby -v: * Backport: 2.1: WONTFIX, 2.2: DONE, 2.3: DONE ---------------------------------------- A module's private constants are given with `Module#constant(false)`. ~~~ruby 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: ~~~ruby A.private_constants # => [:Y] A.private_constants(false) # => [:Y] A.include B A.private_constants # => [:Y, :W] A.private_constants(false) # => [:Y] ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>