[Q] How to check if a constant already exists?

Thanks!

Eric.

Hi,

For toplevel:
defined?(Const)
Object.const_defined?(:Const)

For nested:
defined?(Outer::Const)
Outer.const_defined?(:Const)

···


Nobu Nakada

Thanks a lot!