title: Why does my to_s method return 0 in ruby?
body: <p>I'm trying to build a relatively simple app in ruby. However I am unable to get my object to return anything other than <code>0</code> when <code>puts obj.to_s</code> is called on it. I understand the quality of the code may be poor (and wouldn't mind any hints).</p>
  
  <p>Help please! </p>
  
  <pre><code>class Docpart
    def Docpart.new(inputAsString,typeAsInteger)
  @value = inputAsString
  @type = typeAsInteger.to_i # 0 = title, 1 = text, 2 = equation (can't be done yet), 3 = table
    end
  
    def Docpart.to_s
  return "Type is #{@type}, value is #{@value}"
    end
  end
  
  module Tests
    def Tests.test1()
  filetree = Array.new(0) 
  filetree.push( Docpart.new("Title",0))
  filetree.each{|obj| puts obj.to_s}
  return filetree[0]
    end
  end
  
  puts Tests.test1.to_s
  gets.chomp
  </code></pre>