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?
Thanks.