ice_cube 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,9 +20,10 @@ module IceCube
20
20
  protected
21
21
 
22
22
  def default_jump(date)
23
- date_type = date.utc? ? :utc : :local
24
- next_month = date.month + @interval
25
- Time.send(date_type, date.year + (next_month - 1) / 12, (next_month - 1) % 12 + 1, date.day, date.hour, date.min, date.sec)
23
+ date_utc = date.getutc
24
+ next_month = date_utc.month + @interval
25
+ difference = Time.utc(date_utc.year + (next_month - 1) / 12, (next_month - 1) % 12 + 1, date_utc.day, date_utc.hour, date_utc.min, date_utc.sec) - date
26
+ adjust(date + difference, date)
26
27
  end
27
28
 
28
29
  private
@@ -21,8 +21,10 @@ module IceCube
21
21
 
22
22
  # one year from now, the same month and day of the year
23
23
  def default_jump(date)
24
- date_type = date.utc? ? :utc : :local
25
- Time.send(date_type, date.year + @interval, date.month, date.day, date.hour, date.min, date.sec)
24
+ # calculate the difference in seconds of @interval years away and now
25
+ date_utc = date.getutc
26
+ difference = Time.utc(date_utc.year + @interval, date_utc.month, date_utc.day, date_utc.hour, date_utc.min, date_utc.sec) - date_utc
27
+ adjust(date + difference, date)
26
28
  end
27
29
 
28
30
  private
@@ -1,5 +1,5 @@
1
1
  module IceCube
2
2
 
3
- VERSION = "0.2.5"
3
+ VERSION = "0.2.6"
4
4
 
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 5
9
- version: 0.2.5
8
+ - 6
9
+ version: 0.2.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - John Crepezzi
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-05 00:00:00 -04:00
17
+ date: 2010-04-06 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency