In a lesson from codeschool, the code in the top-left block is demonstrated to be incorrect.
"Of course it is", I say to myself. I've learned it should be @name = name
. What's the new problem? Why is "self" necessary here instead? See my working code below:
class UserList
attr_accessor :name
def initialize(name)
@name = name
end
end
list = UserList.new('celebrities')
list.name