G
Gary Wright
irb(main):001:0> obj = Object.new
=> #<Object:0x8064048>
irb(main):002:0> puts obj
#<Object:0x8064048>
=> nil
irb(main):003:0> puts obj.to_s
#<Object:0x8064048>
=> nil
Seems like it already does what you want. What am I missing?
I think Roger is saying that String#+ should call to_s on its argument.
String#+ already calls to_str on its argument:
text+object
=> nil
Another approach is to use Array#join instead of String#+:
=> "a#<Object:0x1588224>b"['a', Object.new, 'b'].join
Gary Wright