On 22.05.2009 19:29, Eleanor McHugh wrote: > On 22 May 2009, at 18:19, Jp Hastings-spital wrote: >> I'm attempting to build an ETA class, essentially identical to Time, >> but >> where new accepts a number of seconds from now and generates the >> underlying Time object accordingly. Obviously I can't re-assign >> self, so >> how should I do this? >> >> What I'd like to do: >> -- >> class ETA < Time >> def initialize(seconds) >> self = Time.new + seconds >> end >> end > How about something as simple as: > > class ETA < Time > def self.new > ETA.at Time.now + seconds > end > end Actually, what do we need a new class for? Basically this will do as well, unless there are more methods added to ETA that we do not yet know: def Time.future(seconds) now + seconds end Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/