From: Greg Go Date: 2008-01-10T13:11:23+09:00 Subject: Re: DateTime new_offset unexpected results Todd Benson wrote: > On Jan 7, 2008 3:05 PM, Greg Go wrote: >> Thanks for your reply. >> It's only the rise object for this invocation of the day class that >> fails, and only for DST times. > > And only with Rational(-6, 24) during the rise event? > >> @ld = @jd.new_offset(offset) > Try (#'s mark the additional/changed lines)... > > offset = Rational(-7, 24) > puts "dstStart before IF: " << @@dstStart ### > puts "dstEnd before IF: " << @@dstEnd ### > if (@jd > @@dstStart) && (@jd < @@dstEnd) > puts "dstStart after IF: " << @@dstStart ### > puts "dstEnd after IF: " << @@dstEnd ### > offset = Rational(-6, 24) > end > @ld = @jd.new_offset(offset) > > puts @jd ### > puts @ld ### > > and see what you get for the rise event (just out of curiosity). > > Todd Todd: Although I'm not sure what this proves, I did this, and the two class variables (@@dstStart, @@dstEnd) didn't change. I'm unclear as to where you're going with this -- am I missing something with the way that ruby handles class variables? Thanks! Greg -- Posted via http://www.ruby-forum.com/.