From: "Ara.T.Howard" Date: 2004-02-13T11:14:57+09:00 Subject: Re: Swapping out an instance between blinks On Fri, 13 Feb 2004, Gavin Kistner wrote: > Date: Fri, 13 Feb 2004 01:24:34 GMT > From: Gavin Kistner > Newsgroups: comp.lang.ruby > Subject: Re: Swapping out an instance between blinks > > Ara.T.Howard wrote: > >>Is there any way to, inside the method for an instance, magically swap > >>out that instance to be represented by a new instance? > > > > class MutableTime > > def method_missing(meth, *args, &block) > > @time.send(meth, *args, &block) > > end > > end > > Very tricky! (And helpful, since I thought that Time had at least 1 > method for changing the value, but realize I was wrong :) i do that one alot. remember though that (Time === MutableTime.new) == false -a -- ATTN: please update your address books with address below! =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | STP :: http://www.ngdc.noaa.gov/stp/ | NGDC :: http://www.ngdc.noaa.gov/ | NESDIS :: http://www.nesdis.noaa.gov/ | NOAA :: http://www.noaa.gov/ | US DOC :: http://www.commerce.gov/ | | The difference between art and science is that science is what we | understand well enough to explain to a computer. | Art is everything else. | -- Donald Knuth, "Discover" | | /bin/sh -c 'for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done' ===============================================================================