//#https://www.rubyguides.com/2018/11/attr_accessor/ attr_accessor :protein //#For this example, it creates: //# protein //# protein= //#These are the same methods we created before… //#But now you don’t have to type them out. //#It’s a shortcut!# What is attr_accessor, attr_reader or attr_writer in Ruby? # Verbose (hand written reader and writer) class Person def name @name end def name=(str) @name = str end end # or using attr_reader and/or attr_writer class Person attr_reader :name attr_writer :name end # or using attr_accessor class Person attr_accessor :name end # Usage person = Person.new person.name = 'Dennis' person.name # => "Dennis"class Food attr_accessor :protein def initialize(protein) @protein = protein end end