From: James Edward Gray II Date: 2005-10-27T04:38:36+09:00 Subject: Re: how private is private in ruby? On Oct 26, 2005, at 2:32 PM, Peter Ertl wrote: > Why is this allowed / possible? > > class MyUltraSecretKeystore > private > def key > return "nobody-should-read-this-ever" > end > end > > ks = MyUltraSecretKeystore.new > > $ puts ks.send(:key) > >> "nobody-should-read-this-ever" >> > > *yuk* > > so I can just use [public] for _everything_ as well, right? It's true that there are many ways to bypass method scope. Ruby trusts us to do the right thing. We consider things like send() and instance_eval() to be tools. They are perhaps dangerous at times, but they are also very powerful. It's a trade-off. If you're looking for iron-clad laws, Ruby's dynamic nature will probably not appeal to you much. James Edward Gray II