I have a list of ruby files. I would like to create objects from all
classes using eval(classname)

My filelist looks something like:
nl/foo_nl_bar.rb #class NL::FooNLBar
en/bar_en_foo.rb #class EN::BarENFoo

For now my solution is as follows:
File.readlines(rubyfile).find_all{|line|
line.start_with?("class")}.collect{|file|
file.split("<")[0].gsub(/class/, "")}.map(&:strip)

IMHO this is ugly

I tried doing it with Module.constants. It returns the classnames, but
the namespace is missing.
Using String.camelize.constantize returns BarEnFoo. So here the
namespace is also missing and the camelize doesn't work.

Doe anyone know a cleaner solution?

-- 
Posted via http://www.ruby-forum.com/.