From: Gavin Kistner Date: 2006-10-28T01:39:35+09:00 Subject: Re: nil.to_s != "nil" From: Eero Saynatkari [mailto:ruby-ml@kittensoft.org] > true.to_s # => "true" > false.to_s # => "false" > nil.to_s # => "" > > "" is not a valid representation of nil. "nil" is. How do you define "valid"? obj == eval(obj.to_s) ? If that is your criteria, then: a) Most to_s aren't "valid", and b) #inspect is a better shot irb(main):001:0> [ true, false, nil, [], "Hello", 1.24 ].each{ |x| irb(main):002:1* p eval( x.inspect ) irb(main):003:1> } true false nil [] "Hello" 1.24