Ruby loading config (yaml) file in same dir as source
You should get path of the current file by: cnf = YAML::load_file(File.join(File.dirname(File.expand_path(__FILE__)), ‘config.yml’)) EDIT: Since Ruby 2.0 you can simplify that and use: cnf = YAML::load_file(File.join(__dir__, ‘config.yml’))