On Sat, Feb 10, 2007 at 02:23:55AM +0900, noreply / rubyforge.org wrote:
> Initial Comment:
> Module:constants returns unexpected results; e.g.
> 
>       module A
>          C = 1
>          module B
>             p A::B::constants
>          end
>       end
> 
> returns an empty array. This does not fit the documentation:
> 
>       call-seq:
>          mod.constants    => array
> 
>       Returns an array of the names of the constants accessible in
>       <i>mod</i>. This includes the names of constants in any included
>       modules (example at start of section).
> 
> In module A::B the constants A, B, and C are accessible and therefore should be included in the result!?

Accessible, yes.

Accessible **in** A::B? Try:

  p A::B::C

and you will find that C is not in module A::B

Think about it. All the standard library classes, String, Time, etc. are
constants, and they can be "accessed", did you want every single
"accessible" class to be listed in A::B.constants? That would be quite a
large list....

Sam