--------------enigE7FB1E55016114E1B6AA1F68
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 12/19/2011 09:18 AM, Alex Young wrote:
> Jeremy Bopp wrote in post #1037344:
>> If you want the object you may eventually create in Ruby to work mostl=
y
>> like an IO object, take a look at my io-like gem:
>>
>> https://rubygems.org/gems/io-like
>>
>> Unfortunately, it doesn't support the Ruby 1.9 IO API yet, but it shou=
ld
>> get you the basics without a ton of work. :-)
>>
>=20
> That looks interesting, I'll give it a shot.  Do you know if this is
> likely to break horribly?
>=20
>   class MyFunkyBlockDevice < IO
>     include IO::Like
>   end
>=20
> For some fairly boring reasons I do actually want an IO subclass, but I=

> only need reading and seeking to work.

I don't think it should break the definition of the class itself or
simple use cases, but it will likely be a bit confusing to consumers of
your class.  Since the class you create will effectively be lying about
its type if you follow the example above, other logic in the dependent
code could break if you try to feed it such an object though.

What are the "boring reasons" to require a subclass of IO?  If you
control that code, I suggest you tweak the it to make the most of duck
typing.

-Jeremy


--------------enigE7FB1E55016114E1B6AA1F68
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7vWUEACgkQHt4KKRq6Zje0AwCfTr2tcznSm/Gs2+vZ1ZCOqqvX
cFQAoIomN0RR8axHf1Bds+391vIQ6/1K
=oLxA
-----END PGP SIGNATURE-----

--------------enigE7FB1E55016114E1B6AA1F68--