[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

extending a class changes from 1.8.4 to 1.8.6

Tim McIntyre

10/6/2008 7:08:00 PM

require 'date'
class MyDateTime < DateTime end

under ruby 1.8.4:
MyDateTime.now.class -> MyDateTime

under ruby 1.8.6
MyDateTime.now.class -> DateTime


I feel like I missed the boat on something obvious here. I googled
around a bit though and didn't see anything and I have a mission
critical issue that I need to resolve.

Thanks in advance!
Tim
--
Posted via http://www.ruby-....

2 Answers

Tim McIntyre

10/6/2008 7:15:00 PM

0

Tim McIntyre wrote:
> require 'date'
> class MyDateTime < DateTime end
>
> under ruby 1.8.4:
> MyDateTime.now.class -> MyDateTime
>
> under ruby 1.8.6
> MyDateTime.now.class -> DateTime
>
>
> I feel like I missed the boat on something obvious here. I googled
> around a bit though and didn't see anything and I have a mission
> critical issue that I need to resolve.
>
> Thanks in advance!
> Tim

I suppose I should actually ask a question with that:-)

What do I need to do to get the 1.8.4 behavior in 1.8.6?

Thanks!
Tim
--
Posted via http://www.ruby-....

Jano Svitok

10/6/2008 7:23:00 PM

0

On Mon, Oct 6, 2008 at 21:15, Tim McIntyre <tmac@easystreet.com> wrote:
> Tim McIntyre wrote:
>> require 'date'
>> class MyDateTime < DateTime end
>>
>> under ruby 1.8.4:
>> MyDateTime.now.class -> MyDateTime
>>
>> under ruby 1.8.6
>> MyDateTime.now.class -> DateTime
>>
>>
>> I feel like I missed the boat on something obvious here. I googled
>> around a bit though and didn't see anything and I have a mission
>> critical issue that I need to resolve.
>>
>> Thanks in advance!
>> Tim
>
> I suppose I should actually ask a question with that:-)
>
> What do I need to do to get the 1.8.4 behavior in 1.8.6?
>
> Thanks!
> Tim

I suggest looking at lib/date.rb, particularly at Date.now and
Time.now.to_datetime. The rest might depend on your usage.