From: Chad Perrin Date: 2011-05-05T07:19:38+09:00 Subject: Re: Iterating over an Array of Hashes --yNb1oOkm5a9FJOVX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 05, 2011 at 06:38:57AM +0900, Douglas Seifert wrote: > 2 solutions have been presented. I think the original poster's question = was > sufficiently vague to make both of the solutions valid. >=20 > So, original poster: what were your intentions? Did you need the only the > hashes in the array preserved, or did you ALSO need the contents of the > hashes in the array preserved? If the former, then clone/dup is fine. If > the latter, then you need some kind of deep copy. The "simplest" deep co= py > I can think of is the Marshal#dump/load one. Does anyone want to make a bet with me? I bet $10 he says he doesn't want the actual data in the hash to change, if he comes back and says anything one way or the other. My first clue is where he starts out by talking about copying the *data* -- using the word "data" literally -- without simply creating a reference to the original data. --=20 Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] --yNb1oOkm5a9FJOVX Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk3BzdgACgkQ9mn/Pj01uKUSGQCg7Ve/ZORZgBEO8xJf73dJIPW2 /joAn3ZpG6/DEikLhbS4RJ3jqXia8GDX =ex+x -----END PGP SIGNATURE----- --yNb1oOkm5a9FJOVX--