From: senyi Bojorquez Date: 2010-09-02T00:54:05+09:00 Subject: Re: hash problem --_6abac19e-b637-4c2d-a113-8ca29e129628_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Peter You have to do something like this: hash =3D {} hash[:name] =3D 'Senyi' array =3D [] array << hash hash2 =3D {} hash2[:name] =3D 'Peter' array << hash2 =20 =3D> [{:name=3D>"Senyi"}=2C {:name=3D>"Peter"}]=20 I hope it helps you=20 = Senyi =20 > Date: Thu=2C 2 Sep 2010 00:43:12 +0900 > From: peterhickman386@googlemail.com > Subject: Re: hash problem > To: ruby-talk@ruby-lang.org >=20 > Firstly hash notation is {"name" =3D> "Admiral Ackbar"} and not > {"name":"Admiral Ackbar"} (are you thinking about PHP or Python by > chance?) >=20 > To be honest it looks more like you need an Array of hashes. >=20 > data =3D Array.new > data << {"name" =3D> "Admiral Ackbar"} > data << {"name" =3D> "Bail Organa"} >=20 > puts data.inspect > =3D> [{"name"=3D>"Admiral Ackbar"}=2C {"name"=3D>"Bail Organa"}] >=20 = --_6abac19e-b637-4c2d-a113-8ca29e129628_--