On Wed, Mar 12, 2014 at 11:03 AM, Arup Rakshit <lists / ruby-forum.com> wrote:

Xavier Noria wrote in post #1139583:
> > On Wed, Mar 12, 2014 at 9:40 AM, Arup Rakshit <lists / ruby-forum.com>
>
> > On the other hand that "X" is stored in the set of constants of the
> > singleton class of M::Z, let's call it S. M::Z::X looks for "X" in the
> > constants table of M::Z and its ancestors, since none of them is S, the
> > lookup fails.
>
> Okay. Got it.
>
> module M
>   class Z
>     Num = 10
>     class << self
>       Big = 11
>   def foo; 12 ; end
>     end
>   end
> end
>
> M::Z.singleton_class::Big # => 12
> M::Z.constants.grep(/Num/) # => [:Num]
>
> Why the below didn't give me [:Big] ?
>
> M::Z.singleton_class.constants.grep(/Big/) # => [:Bignum]


It does not make sense, I'd bet this is a bug.