ruby check if constant exists

if Object.const_defined?(:YourConstant)
  puts "Constant exists!"
else
  puts "Constant does not exist."
end