ruby - Telling from a symbol name whether a constant is a module -
if know module (or class) m has constant in namespace name represented symbol sym (whose value is, example, :foo), efficient way know whether constant module (or class) or not? came following. there improve way?
m.const_get(sym).kind_of?(module) ruby module constants symbol
No comments:
Post a Comment