From: Eero Saynatkari Date: 2006-10-27T14:03:37+09:00 Subject: Re: nil.to_s != "nil" --flDc4cbvG5Y7qIjC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2006.10.27 13:56, Dmitri Priimak wrote: > Eero Saynatkari wrote: >=20 > >Is it possible to change NilClass#to_s to return "nil" > >rather than "" since "" !=3D nil? > >=20 > > > -- test.rb BEGIN > p nil.to_s.nil? >=20 > class NilClass > def to_s > nil > end > end >=20 > p nil > p nil.to_s.nil? > -- test.rb END >=20 > $ ruby test.rb > false > nil > true I should have been clearer. I was wondering if it could be fixed in the language itself :) Thank you though! --flDc4cbvG5Y7qIjC Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFQZKU7Nh7RM4TrhIRAmV4AJ9XwE/OchHZggB90B2/g/rb6k+TXwCeJvLw Vv+QnLHwXqKYyi5XT0qe9Yg= =tlyt -----END PGP SIGNATURE----- --flDc4cbvG5Y7qIjC--