From: Simen Edvardsen Date: 2007-07-04T21:26:59+09:00 Subject: Re: Verify if a class exists On 7/4/07, Bernd wrote: > Hello everybody, > > is there a way to check, if a class exists? I create classes dynamically > and would like to know before, if a class with that name already exists. > > Thanks for your help > Bernd > > -- > Posted via http://www.ruby-forum.com/. > > Try a const_get. Like so: def class_exists?(name) begin true if Kernel.const_get(name) rescue NameError false end end -- - Simen