From: David Vallner Date: 2006-12-18T03:05:25+09:00 Subject: Re: why private is not private --------------enig38EE1D4D76FBDC9E1E7A3E19 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Li Chen wrote: > Pat Maddox wrote: >=20 >=20 >> Just to expand on David's point a little... >> >> Since everything is an object in Ruby, you have to be in SOME context >> relating to an object. Any time you call a method without an explicit= >> receiver, the receiver defaults to self. So in that example you end >> up calling >> self.method1 >> >> which is fine, as you'd expect. >=20 > One more question: in my previouse script what does self really refer=20 > to? >=20 > Thanks, >=20 > Li >=20 C:\Documents and Settings\David>irb irb(main):001:0> self =3D> main irb(main):002:0> self.class =3D> Object irb(main):003:0> A "special" Object Ruby creates to evaluate everything else in. I don't even think there's that much special about it beyond what an Object.new call would do (aside from the fact it comes with the ruby core already loaded by the interpreter.) David Vallner --------------enig38EE1D4D76FBDC9E1E7A3E19 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.5 (MingW32) iD8DBQFFhYbcy6MhrS8astoRAqiTAJ4uDBERYS0la4NRGa2Kaz3CWllgrgCfdwH1 sF5qMuIZ2Cv8YrnNDyRmrcs= =8VQp -----END PGP SIGNATURE----- --------------enig38EE1D4D76FBDC9E1E7A3E19--