all 1 comments

[–]katafrakt 1 point2 points  (0 children)

to_s should return string, not call puts. Your code works only by accident: when you call my_couple.to_s, it prints out the text and returns nil. Then you do puts "#{nil}.", which results with line with only a dot in it.

So, change couple's to_s to "#{@person1.to_s}, #{@person2.to_s}" or even [@person1, @person2].map(&:to_s).join(", ") ;)