Ruby Build an Address Book in Ruby Class Design Write a to_s Method

My code works under Notepad++. Why does Treehouse complain about a bad format?

I think my to_s method is correct. If the editor doesn't like the output it should display what my code produces against expected results so that I can make any necessary corrections.

class PhoneNumber
  attr_reader :kind, :number

  def initialize(kind, number)
    @kind = kind
    @number = number

  def to_s
    puts "#{@kind}: #{@number}"


2 Answers

Jordan Bowman
Jordan Bowman
9,439 Points

You don't need the puts because the to_s method already prints a string for you. If you remove that, it should pass!

Thank you! That did the trick!!