From: Ilan Berci Date: 2008-01-29T05:28:56+09:00 Subject: Re: Problem loading a YAML file Keith Carter wrote: > I'm having issues loading a YAML file. Here is the YAML file (named > test.yml): > > foo: 5 > bar: some string > > Here is my Ruby: > > C:\noozler\trunk>ruby script/console > Loading development environment (Rails 2.0.2) >>> require 'yaml' > => [] >>> File.exists?("test.yml") > => true >>> t = YAML::load("test.yml") > => "test.yml" >>> t['bar'] > => nil >>> > > I would expect t['bar'] to show: "some string". > > Any ideas? The "t" you are loading is a String.. always check the types for a clue.. :) irb(main):002:0> require 'yaml' => true irb(main):003:0> File.open("test.yml") {|f| YAML::load(f)['bar']} => "some string" hth ilan -- Posted via http://www.ruby-forum.com/.