I have a class and I try to access an instance variable and I noticed I can do it in both ways by addressing it with @ and without it. Why si there no error when I call it without a @ puts "name : #{name}"?
class Blabla attr_accessor :name def initialize(blabla) @name = blabla end def populate() puts "name : #{name}" puts "name : #{@name}" end end
attr_accessor :nameattr_reader :nameI have the same, so is there any way I can avoid this behavior but still be able to read the instance variable?attr_accessor/attr_readerthere, again?