From: Jamie Macey Date: 2006-06-03T04:00:43+09:00 Subject: Re: [QUIZ] Hash to OpenStruct (#81) > Here's a sample YAML document to get you started: > > --- > foo: 1 > bar: > baz: [1, 2, 3] > quux: 42 > doctors: > - William Hartnell > - Patrick Troughton > - Jon Pertwee > - Tom Baker > - Peter Davison > - Colin Baker > - Sylvester McCoy > - Paul McGann > - Christopher Eccleston > - David Tennant > a: {x: 1, y: 2, z: 3} Ahh, a nice, quick one. I had a 7 line method, that became 6 lines, that became 4 lines... became 2 really ugly lines if I can include and not count a helper method to turn mapped Hashes back into Hashes. My output, reformatted for prettiness (it also handles Ara's additions): #, quux=42, doctors=[ "William Hartnell", "Patrick Troughton", "Jon Pertwee", "Tom Baker", "Peter Davison", "Colin Baker", "Sylvester McCoy", "Paul McGann", "Christopher Eccleston", "David Tennant" ], baz=[1, 2, 3] > > - Jamie