title: How can I properly chain custom methods in Ruby?
body: <p>I am trying to do a chaining method for the following two methods. After running this code, I kept getting the following output: </p>
  
  <pre><code>#&lt;SimpleMath:0x007fc85898ab70&gt;% 
  </code></pre>
  
  <p>My question is: what is the proper way of chaining methods in <code>Ruby</code>? </p>
  
  <p>Here is my codes: </p>
  
  <pre><code>class SimpleMath
  
  
      def add(a,b=0)
          a + b
          return self
      end
  
  
      def subtract(a,b=0)
           a - b
          return self
      end
  
  end
  newNumber = SimpleMath.new()
  print newNumber.add(2,3).add(2)
  </code></pre>