Hi --

On Tue, 13 Jan 2009, Sebastian Hungerecker wrote:

> Martin DeMello wrote:
>> On Mon, Jan 12, 2009 at 11:56 AM, Mike Stephens <rubfor / recitel.net> wrote:
>>> been specifically declared as public or global. Ruby of course allows
>>> you to directly access data declared as private. These are examples of
>>
>> Ruby does not. Try this
>>
>> class A
>>   def initialize
>>     @foo = 28
>>   end
>> end
>>
>> a = A.new
>> a.foo
>
> a.instance_variable_get(:@foo)

I wouldn't call that accessing it "directly" though :-)


David

-- 
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)

http://www.wishsight.com => Independent, social wishlist management!