method

const_defined?

v1_9_1_378 - Show latest stable - Class: Module
const_defined?(p1, p2 = v2)
public

Returns true if a constant with the given name is defined by mod, or its ancestors if inherit is not false.

Math.const_defined? "PI"   #=> true
IO.const_defined? "SYNC"   #=> true
IO.const_defined? "SYNC", false   #=> false