From: dis guy Date: 2012-09-26T12:02:11+09:00 Subject: deserialize from yaml into array of objects I have a yaml file which has many records like: - !ruby/object:Employee first_name: John last_name: Gippert gender: male city: Detroit state: MI Programs: - !ruby/object:Program program_id: 3 program_name: 401K -can be a varied number of programs for each employee I need to parse this yaml file into an array of Employees. I have a class variable which is an array. I would like to populate this array with the employees, so I can use Array.Select to search for first name, etc. This code doesn't work and I am very new to Ruby. Have spent a lot of time searching for this but cannot make it work. Please be specific and provide details with your answers. dep = Department.new dep.employees= YAML::parse( File.read("university_db.yml")) puts(db.employee.select{ |el| el.first_name == "john" }.length) class Department attr_accessor :employees def initialize @employees= [] end end -- Posted via http://www.ruby-forum.com/.