On Friday 23 February 2001 13:15, David Alan Black wrote: > On Sat, 24 Feb 2001, W. Kent Starr wrote: > > On Friday 23 February 2001 10:32, David Alan Black wrote: > > > Here's a followup question, based on playing around with this: > > > Why do the two ways of doing this (which I've stashed into > > > MyTime.floor) result in objects of different types? > > > > > > class MyTime < Time > > > def MyTime.floor > > > > > > # Way 1 > > > t = Time.new > > > mt = MyTime.at t - t.sec > > > > > > # Way 2 > > > tt = MyTime.at (tm = Time.new) - tm.sec > > > > > > [mt,tt].each do |ti| > > > puts "#{ti} is of type #{ti.type}" > > > end > > > end > > > end > > > > > > MyTime.floor > > > > > > Output: > > > Fri Feb 23 10:31:00 EST 2001 is of type MyTime > > > Fri Feb 23 10:31:00 EST 2001 is of type Time > > > > FWIW > > > > Time.type #-> Class > > class MyTime < Time > > end > > MyTime.type #-> Class > > a = Time.new > > b = MyTime.new > > a.type #-> Time > > b.type #-> MyTime > > > > It appears that a class is of type Class and instances of that class are > > of type #{Name_Of_That_Class} > > > > Interesting (and useful) behavior :-) > > Indispensable, even :-) But I don't see the connection with my question. > But see earlier answers from Dave T. and Guy D. > Er, no it doesn't :-) (That's what I get for reading the output and not how it is derived!) > (Is there *anyone* on this list without at least one name twin? Slight > exaggeration... but still!) > Are there more than one Kent? :-) Regards, Kent Starr elderburn / mindspring.com