Reputation: 305
How to override the "to string" method of an object?
I'm getting the following when printing my object to console:
#<User:0x7fdd9811eb80>
I'm required to have a user-readable version of the object.
Upvotes: 1
Views: 207
Override the #to_s method. For me it was the following within the class definition:
#to_s
def to_s() : String first_name + " " + last_name end