class Song
  # ...
  def title         # attribute reader
    @title          # returns instance variable
  end
  def title=(title) # attribute setter
    @title = title 
  end
end

Example 3: Writing your own attribute methods.

Back to Article