Xavier Noria wrote in post #1119213:

> That #map should be an #each, it works but it is unnecessary (comes from
> editing a previous attempt).

Thanks for your reply:

I did it as below:

module A
  module B
    class B2
      class B1Error < Exception ;$b= Module.nesting ; end
      class B2_inner
        $a = Module.nesting
      end
    end
  end
end

($a | $b)
# => [A::B::B2::B2_inner, A::B::B2, A::B, A, A::B::B2::B1Error]
($a | $b).map{|e| e.respond_to?(:superclass)}
# => [true, true, false, false, true]
($a | $b).select{|e| e.respond_to?(:superclass)}
# => [A::B::B2::B2_inner, A::B::B2, A::B::B2::B1Error]

Is my approach is acceptable ?

-- 
Posted via http://www.ruby-forum.com/.