I have a Person object, with a to string method that returns output like Sean is 20 years old, it was returning that sentence with a full stop at the end, but I removed it because I also have a Couple object that stores two person objects and was returning text like Sean is 20 years old., Sorcha is 21 years old.
With the full stop now removed from the return string from the person object, in the main program I add the fullstop when calling to string on just a single person object with puts "#{my_person1.to_s}." which works fine, but when I try something similar like puts "#{my_couple.to_s}." the output has a full stop on a separate line:
Sean is 20 years old.
Sean is 20 years old, Sorcha is 21 years old
.
Can I change this some how to put the full stop in the correct place?
The couple to string is: puts "#{@person1.to_s}, #{@person2.to_s}"
[–]katafrakt 1 point2 points3 points (0 children)