From: Eric Hodel Date: 2003-09-11T13:59:12-07:00 Subject: Re: Passing an Object Class from a method to a caller --Sw7tCqrGA+HQ0/zt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable RLMuller (RLMuller@comcast.net) wrote: > obj =3D "abc" > print "Type of object '#{obj.to_s}' is '#{getTypeOf(obj).to_s}'\n\n}" >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > Here's what I get when running under SciTE: >=20 > ndex =3D 2: Type =3D 'String' > Type of object 'abc' is '' >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > I originally tried to place the .to_s after "result" in the > subroutine, instead of after the invocation of getTypeOf, to no > avail. >=20 > Any ideas? Why not instead use obj.class.name: obj =3D "abc" puts "Type of object '#{obj}' is #{obj.class.name}" --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --Sw7tCqrGA+HQ0/zt Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE/YOIgMypVHHlsnwQRAgnsAJ9RrWzVkIWlU2TkjWe4ki3XIj9hoQCgkEjW cuQ2fMGjFN87qFlwUaBBgkI= =XYDL -----END PGP SIGNATURE----- --Sw7tCqrGA+HQ0/zt--