From: "Marcin Mielżyński" Date: 2004-08-07T22:56:48+09:00 Subject: const_defined? raises NameError ? Hi, Given a const how can I check whether the const exists without rescuing an exception thrown - if it isn't? (using const_set is not elegant since You have to supply a special value) if const_defined?('SomeConst') ... end My next qusetion is: Assuming there is a nested const: module SomeModule Const="somevalue" end the only way to access it by reflection is: s='SomeModule::Const' mod,con=s.split(/::/).map{|e|e.strip} Object.const_get(mod).const_get(con) wouldn't it be easier if the following worked avoiding any eval calls: object.const_get('SomeModule::Const') TIA Marcin Mielzynski