# Overloading to\_s method

**URL:** <https://www.ruby-forum.com/t/overloading-to-s-method/178263>\
**Category:** Ruby\
**Created:** [November 1, 2009, 4:14pm UTC](https://www.ruby-forum.com/t/overloading-to-s-method/178263 "2009-11-01T16:14:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![referas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac91a4/32.png) [@referas](https://www.ruby-forum.com/u/referas)\
**Post date:** [November 1, 2009, 4:14pm UTC](https://www.ruby-forum.com/t/overloading-to-s-method/178263/1 "2009-11-01T16:14:59Z")

</div>

Hello,

Programming is not new to me, but Ruby is. I am having problems with  
overloaded ‘to\_s’ method. Lets say we have a simple class with this  
method. When I use it, it prints what I have written, but it adds ‘nil’  
to the end. How do I get rid of it. Formatting string seems to be a way  
around, but is there something I am doing wrong?

---

<div class="post-metadata">

**Author:** ![referas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac91a4/32.png) [@referas](https://www.ruby-forum.com/u/referas)\
**Post date:** [November 1, 2009, 4:23pm UTC](https://www.ruby-forum.com/t/overloading-to-s-method/178263/2 "2009-11-01T16:23:12Z")

</div>

Nevermind 🙂 I got it.
