you need to use @@name.

On 3/14/06, Nathan Olberding <nathan.olberding / gmail.com> wrote:
> I've got a class. I want some methods of this class to be able to edit
> some data that's "global" within any given instance of this class. For
> example:
>
> class Person
>
>    @name
>
>    def changeName(newName)
>       @name = newName
>    end
>
>    def sayName()
>       puts "My name is " + @name
>    end
> end
>
> It seems that @name reverts back once I leave the scope of any method
> that manipulates it.
>
> --
> Posted via http://www.ruby-forum.com/.
>
>