From: Sergey Sheypak Date: 2010-02-11T17:47:49+09:00 Subject: Newbee question. Runtime classloading Hello, I'm Java developer and now explore Ruby for increasing programming knowledge. I want to understand runtime class loading I have an application: /lib/parser_factory.rb class ParserFactory end /lib/parser_format_x.rb class ParserFormatA end /lib/parser_format_y.rb class ParserFormatB end /lib/parser_format_z.rb class ParserFormatC end ParserFactory gets file and decides which parser to initialize and use. I have such code in ParserFactory: clz = "ParserFormat#{@version}" parser_impl = Kernel.const_get(clz) and I get an error: Test-unit version : 2.0.1 loaded 1) Error: test_parsing(ParserTest): NameError: uninitialized constant Kernel::ParserPlanFormat1_0 D:/Ruby_1_86_27/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:2237:in `const_missing' I don't get how I have to specify path to class. I've tried it as in Java: "parsers/SomeClass", but it didn't help :) Also i'm exploring Ruby on Rails and Kernel.const_get("MyFavouriteModelClass") works there. Please explain or give guide to read. -- Posted via http://www.ruby-forum.com/.