Ruby OOP

When attr_accessor :name is available inside a class, if instance varaible is not assign yet, we should use self.name = “something” to assign it.

If you use name = “something” to try to invoke setter method before a instance variable create, Ruby will assume that you are going to create a local variable.

Like what you read? Give newfishg a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.