From: Sergey Sheypak Date: 2010-02-12T00:41:37+09:00 Subject: Re: Newbee question. Runtime classloading > Xavier Noria wrote: Excuse me for disturbing you again. I have pretty close question. I don't get how to locate files inside ruby-project. In Rails I've used 'RAILS_ROOT' and it was clear to me how does it work. And what about usual ruby app? 1. NetBeans generated TestUnit gets this string: $:.unshift File.join(File.dirname(__FILE__),'..','lib') What for? 2. My project structure: project: \lib \lib\main.rb \lib\some_file.rb \lib\parsers\yaml_parser.rb \data \data\yaml_parser_config.yml \data\source.scv \data\Format_1.0.yml I keep config files in 'data' catalog. Is it good way to ref these resources in this way: #Some TestUnit def test_read @conf = YAML.load_file( 'data/Format_1.0.yml' ) #Good or bad? assert_equal(Hash, @conf.class) assert_equal("Dates",@conf['Dates']['class']) assert_equal(["id", "descr", "rough_est", "accurate_est", "spent", "left", "resource_id", "begin", "end"],@conf['Tasks']['fields_ordered']) end or in some Parser class: @parser_config = YAML.load_file('data/Format_1.0.yml' ) ) Or I have to use some 'magic' ruby variables? -- Posted via http://www.ruby-forum.com/.