From: David Vallner Date: 2006-12-18T01:43:49+09:00 Subject: Re: why private is not private --------------enig50359ADEA8BAA52DA73605D5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Li Chen wrote: > Hi all, >=20 > I add a private method to class Object and try to call it from outside > the class. I am confused that it works. Any comments? >=20 > Thanks, >=20 > Li > ## > class Object > private > def method1(arg1) > arg1 > end > end >=20 > puts "call private method" > puts method1(1) >=20 > ## >> ruby variables3.rb > call private method > 1 >> Exit code: 0 >=20 The toplevel execution context is also an instance of Object. You're still inside an instance of the class you've defined #method1 on. David Vallner --------------enig50359ADEA8BAA52DA73605D5 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) iD8DBQFFhXO/y6MhrS8astoRAuqMAJ9J8PG6PkQCn33sz8jOOW9OL8S70wCdEa4X 9/g3uZH1cvqtkykwkBose2w= =w0w5 -----END PGP SIGNATURE----- --------------enig50359ADEA8BAA52DA73605D5--