Ruby has this handy and convenient way to share instance variables by using keys like
attr_accessor :var
attr_reader :var
attr_writer :var
All of the answers above are correct; attr_reader and attr_writer are more convenient to write than manually typing the methods they are shorthands for. Apart from that they offer much better performance than writing the method definition yourself. For more info see slide 152 onwards from this talk (PDF) by Aaron Patterson.