A better way to find a module's children?

Posted by c00lryguy on Stack Overflow See other posts from Stack Overflow or by c00lryguy
Published on 2010-05-04T14:09:45Z Indexed on 2010/05/05 8:38 UTC
Read the original article Hit count: 166

Filed under:
|

This is what I've got, but it also finds classes and other constants.. is there a better way?

class Module
    def children
        constants.collect { |c| const_get(c) }.compact
    end
end

© Stack Overflow or respective owner

Related posts about ruby

Related posts about metaprogramming