From: Trans Date: 2008-04-24T23:29:04+09:00 Subject: Re: How secure is replacing "to_s" method? On Apr 24, 9:04 am, "Iņaki Baz Castillo" wrote: > Hi, I've a class like this: > > class Request > attr_accessor :method, :code > def to_s > "#{method} #{code}" > end > end > > So if I print directly an instance I see a string containing both attributes: > > message = Request.new > message.method = "INVITE" > message.code = "200" > puts message > => "INVITE 200" > > This is really nice but I'm not sure of how secure it's. Could > replacing "to_s" method change any other behaviour? It's fine for your own classes. T.