I Just started learning ruby and I don\'t see the difference between an @instace_variable and an attribute declared using attr_accessor.
@instace_variable
attr_accessor
Wh
And another answer more compact (for Java developers) attr_accessor :x creates the getters and setters to @x
attr_accessor :x
@x
class MyClassA attr_accessor :x end
is the same as
class MyClassB def x=(value) #java's typical setX(..) @x=value end def x @x end end