attr_accessor is a Ruby language method used to create getter and setter methods for instance variables.
For example, if you have an instance variable @name, you can use attr_accessor to create getter and setter methods for it:
class Person
attr_accessor :name
end
person = Person.new
person.name = “John”
puts person.name # => “John