--hTyD2MSx3HZlTIuF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Alexey Verkhovsky (alex_verk / mail.ru) wrote:

> Context: I needed to teach a subclass of Test::Unit::TestCase to assert=
=20
> that a particular block writes something to an output stream.
>=20
> In Java, an easy way to do something like this is with a pair of=20
> PipedOutputStream/PipedInputStream pair. So I tried the same thing in=20
> Ruby, and the result looks bit hairy to me. Having to use multi-process=
=20
> semantics to write top a buffer and then read from it is a bit over the=
=20
> top. There must be some better way.

Have you looked at StringIO?

--=20
Eric Hodel - drbrain / segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04


--hTyD2MSx3HZlTIuF
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQFAbb/jMypVHHlsnwQRApfOAJ0XSRzRwdMeyMwKUO3IwtSbU8uzHQCcCs2+
T811N8ivk9JXNAQ/Jhsh2jc=
=kktI
-----END PGP SIGNATURE-----

--hTyD2MSx3HZlTIuF--

Alexey Verkhovsky (alex_verk / mail.ru) wrote:

> Context: I needed to teach a subclass of Test::Unit::TestCase to assert=
=20
> that a particular block writes something to an output stream.
>=20
> In Java, an easy way to do something like this is with a pair of=20
> PipedOutputStream/PipedInputStream pair. So I tried the same thing in=20
> Ruby, and the result looks bit hairy to me. Having to use multi-process=
=20
> semantics to write top a buffer and then read from it is a bit over the=
=20
> top. There must be some better way.

Have you looked at StringIO?

--=20
Eric Hodel - drbrain / segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQFAbb/jMypVHHlsnwQRApfOAJ0XSRzRwdMeyMwKUO3IwtSbU8uzHQCcCs2+
T811N8ivk9JXNAQ/Jhsh2jc=
=kktI
-----END PGP SIGNATURE-----