Loading a yaml File

jef
Mon, 19 May 2008 17:36:42 -0000

Hi there.

I have a yaml file like this:

---
first_name: "paul"
age: 23
---
first_name: "peter"
age: 26
---
first_name: "luc"
age: 40

I load my yaml file in a variable called data:
data = YAML.load_file("my_file.yaml")

I only get the first register.

I would like to get the whole file in a array like that:
[{"first_name"=>"paul","age"=>
23},{"first_name"=>"pierre","age"=> 26},
{"first_name"=>"luc"","age"=> 40}]

How can i do that

Thank you for your help.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---