From: Pete McBreen Date: 2002-04-20T00:38:10+09:00 Subject: Re: object question Roy J. Milican asked > I remember reading some where in one of the many Ruby books I have > that you can change what an object returns when you call it by > itself. Usually it returns the object ID. But I can't find where I > read this and I've looked everywhere. Any one like to give me a > hand on this one? Are you thinking of the to_s method? irb(main):001:0> class Cat;end nil irb(main):002:0> c = Cat.new # irb(main):003:0> c # irb(main):004:0> class Cat irb(main):005:1> def to_s irb(main):006:2> return "meow" irb(main):007:2> end irb(main):008:1> end nil irb(main):009:0> c meow irb(main):010:0> Pete ---- Pete McBreen, McBreen.Consulting , Cochrane, AB email: petemcbreen@acm.org http://www.mcbreen.ab.ca/ Author, "Software Craftsmanship The New Imperative" Addison-Wesley (C) 2002 http://www.amazon.com/exec/obidos/ASIN/0201733862 Finalist for the 2002 Jolt Awards