extending a class changes from 1.8.4 to 1.8.6

T

Tim McIntyre

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
 
T

Tim McIntyre

Tim said:
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
 
J

Jano Svitok

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top