if defined constant ruby code example Example: ruby check if constant exists Object.const_defined?(const.to_s)