krainboltgreene / time-lord

time-lord is a ruby gem that adds extra functionality to the time class.
MIT License
156 stars 19 forks source link

time-lord screws up active_support #16

Open dmacvicar opened 11 years ago

dmacvicar commented 11 years ago

I had the problem that I could not get Date#end_of_week to work on my program, but it did work on irb:

from my program:

(Date.today.beginning_of_week..Date.today.end_of_week)
=>  Mon, 22 Jul 2013..Sat, 13 Oct 2959

irb:

(Date.today.beginning_of_week..Date.today.end_of_week)
=> Mon, 22 Jul 2013..Sun, 28 Jul 2013

Then I realized:

(rdb:1) 1.method(:days).source_location
 ["/space/rbenv/versions/1.9.3-p194/lib64/ruby/gems/1.9.1/gems/time-lord-1.0.1/lib/time-lord/extensions/integer.rb", 3]

 [3] pry(main)> 1.method(:days).source_location 
 => ["/space/rbenv/versions/1.9.3-p194/lib64/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/core_ext/numeric/time.rb",

I can then reproduce the wrong range by just loading time-lord.

krainboltgreene commented 11 years ago

While this is indeed an issue (I think), I would advise not using time-lord with active_support.

The goal of time-lord (and tardis) is to extract the time/date parts of active_support for non-rails apps.