From: niklas | brueckenschlaeger Date: 2011-02-24T07:00:07+09:00 Subject: Re: a, b = Array.new(2).map!{|x| data.dup} --=-nlWX7InScHZ/VbZCP06B Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Are you sure you can't rework your code to *not* copy data 5x? I assume you're doing conversion between formats, so the output will be something completely else anyway. No need to work in-place then (which I assume is the reason you're dup-ing). -- niklas On Thu, 2011-02-24 at 06:46 +0900, Stefan Salewski wrote: > I think I can replace this code >=20 > @scr =3D @output.dup > @png =3D @output.dup > @pdf =3D @output.dup > @svg =3D @output.dup > @ps =3D @output.dup >=20 > with this equivalent: >=20 > @scr, @png, @pdf, @svg, @ps =3D Array.new(5).map!{|x| @output.dup} >=20 > Is there a nicer variant available? >=20 > (Of course @scr, @png, @pdf, @svg, @ps =3D @output.dup will not work, I > need 5 independent instances.) >=20 > Thanks, >=20 > Stefan Salewski >=20 >=20 >=20 --=-nlWX7InScHZ/VbZCP06B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAABAgAGBQJNZYNeAAoJEIQdQGZOjo8275kP/0zsol2rqmk9u6VzvSI98FpG WdtQXKLgYmtPIg4eLBuhFjj3p/EZB4I72+95WimUeCPy8Jo5EsiNiehDxIunRVQM su11vqA+o9uDvA+XojbwMjYI2OkV5ebwbkP0cYGTWV312/xRs6F526sXLobVkcr8 GSJfpbAbTiMOICYD0qmyFCIFR9LENm8bMZ/q3q3xqHB5a4z91E4wwwnVy58W2pXH 9Ctn97mphqFuznmCG9ZEPXkL3RCGMC9xZE3HSTCy9ptr0NHCmRwn+kIJkFqXRU9X THm333nUqCJBY5C7l2E8vPTNOEBTw3qe63Es9mNIGvGob6KE4yeCWlvSd6J8hwlw WujtNcdiIY1LgK6ApoSvznBhTJ2UCWfbMkCp2YEgtLLg2XnZkx3K4068dyexrQQi eYMNiQwmBf2cC32NnFSpYjbvi4OuWxn74+GicDOuv3YrvTE11W6nNT61PxDvGDDv 9x7TVbBapoJXmgYjI2dYa0w0DlJviSEZXf0f7kZKjzsj3dqzncnvEzpIZVLQeoUk 4ETAxsYg9UXwOo9wHmLmXIHiXlQJGC9cgBcUb87dS8Ghvv9pqi/bjdNS2IvcWRI1 QPt6qTh/pjK4xAEPRUYQ9Hb99h55ROpUJC5CZ8+Vs1UaGhK7quliJYaLapyXyZrx 2Oont+Dt8d09AhmcqfHQ =zrdd -----END PGP SIGNATURE----- --=-nlWX7InScHZ/VbZCP06B--