On Dec 28, 2005, at 2:51 PM, Austin Ziegler wrote:

> When you do:
>
>    attr_accessor :my_name
>
> You do NOT get a @my_name variable. You get two methods: Foo#my_name
> and Foo#my_name= -- that's it. Consider:
>
>>> class Foo
>>>   attr_accessor :bar
>>> end
> => nil
>>> baz = Foo.new
> => #<Foo:0x2d8aea8>
>
> Note. Thus far, there's no instance variable @bar on the Foo  
> instance baz.
>
>>> Foo.instance_methods(false)
> => ["bar", "bar="]
>
> There's our instance methods.
>
>>> baz.bar = 32
> => 32
>>> baz
> => #<Foo:0x2d8aea8 @bar=32>
>
> Now that we've called Foo#bar= on the baz instance of Foo class, baz
> finally has a @bar instance variable. But not a moment before, unless
> we instantiate such an instance variable prior to the call of
> Foo#bar=.

That's what I suspected as shown in the comments of my last example,  
but Austin explains it much better.  Learn something new all the  
time...  :)

James Edward Gray II