On Mon, May 2, 2011 at 8:15 PM, Clifford Heath <no / spam.please.net> wrote:
> On 05/03/11 11:13, Adam Prescott wrote:
>>
>> On Tue, May 3, 2011 at 1:45 AM, 7stud --<bbxx789_05ss / yahoo.com> wrote:
>>>
>>> Instance methods are private by default. If you define an accessor
>>> method, then they become public-like:
>>
>> I think you meant to say "instance variables", not "methods".
>
> and instance variables are available to all subclasses, also
> when the class is re-opened... so "protected", not private.

The instance variables of an object are not available outside of the
instance (well, except via intrusive methods like
#instance_variable_set), so Ruby instance variables are more like
private data variables than protected ones. Sure, instances of
subclasses of the objects class and other members of the same class as
an object are likely to have instance variables of the same names (or,
maybe not, as instance variables can be dynamically created and
destroyed), but that doesn't really reflect anything about the
visibility of the instance variables of the particular object.