From: George Malamidis Date: 2008-01-29T20:11:47+09:00 Subject: Re: Problem loading a YAML file Or t = YAML::load_file 'test.yaml' George On 29 Jan 2008, at 10:57, Andrea Fazzi wrote: > Try this: > > require 'yaml' > > t = YAML::load( File.open('test.yaml') ) > t['bar'] > > Keith Carter ha scritto: >> 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? >> > >