A better way to fine 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/04
14:28 UTC
Read the original article
Hit count: 212
ruby
|metaprogramming
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