ice_cube 0.2.3 → 0.2.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ module IceCube
5
5
  # Determine whether this rule occurs on a give date.
6
6
  def in_interval?(date, start_date)
7
7
  #make sure we're in a proper interval
8
- day_count = ((date - start_date) / ONE_DAY).to_i
8
+ day_count = ((date - start_date) / IceCube::ONE_DAY).to_i
9
9
  day_count % @interval == 0
10
10
  end
11
11
 
@@ -16,7 +16,7 @@ module IceCube
16
16
  protected
17
17
 
18
18
  def default_jump(date)
19
- goal = date + ONE_DAY * @interval
19
+ goal = date + IceCube::ONE_DAY * @interval
20
20
  adjust(goal, date)
21
21
  end
22
22
 
@@ -5,7 +5,7 @@ module IceCube
5
5
  # Determine whether this rule occurs on a give date.
6
6
  def in_interval?(date, start_date)
7
7
  #make sure we're in a proper interval
8
- day_count = ((date - start_date) / ONE_HOUR).to_i
8
+ day_count = ((date - start_date) / IceCube::ONE_HOUR).to_i
9
9
  day_count % @interval == 0
10
10
  end
11
11
 
@@ -16,7 +16,7 @@ module IceCube
16
16
  protected
17
17
 
18
18
  def default_jump(date)
19
- date + ONE_HOUR * @interval
19
+ date + IceCube::ONE_HOUR * @interval
20
20
  end
21
21
 
22
22
  private
@@ -5,7 +5,7 @@ module IceCube
5
5
  # Determine whether this rule occurs on a give date.
6
6
  def in_interval?(date, start_date)
7
7
  #make sure we're in a proper interval
8
- day_count = ((date - start_date) / ONE_MINUTE).to_i
8
+ day_count = ((date - start_date) / IceCube::ONE_MINUTE).to_i
9
9
  day_count % @interval == 0
10
10
  end
11
11
 
@@ -16,7 +16,7 @@ module IceCube
16
16
  protected
17
17
 
18
18
  def default_jump(date)
19
- date + ONE_MINUTE
19
+ date + IceCube::ONE_MINUTE
20
20
  end
21
21
 
22
22
  private
@@ -18,7 +18,7 @@ module IceCube
18
18
  protected
19
19
 
20
20
  def default_jump(date)
21
- goal = date + 7 * ONE_DAY * @interval
21
+ goal = date + 7 * IceCube::ONE_DAY * @interval
22
22
  adjust(goal, date)
23
23
  end
24
24
 
@@ -29,7 +29,7 @@ module DayValidation
29
29
  end
30
30
  days.compact!
31
31
  # go to the closest distance away, the start of that day
32
- goal = date + days.min * ONE_DAY
32
+ goal = date + days.min * IceCube::ONE_DAY
33
33
  adjust(goal, date)
34
34
  end
35
35
 
@@ -44,7 +44,7 @@ module DayOfMonthValidation
44
44
  distances = distances.select { |d| d > 0 }
45
45
  return nil if distances.empty?
46
46
  # return the start of the proper day
47
- goal = date + distances.min * ONE_DAY
47
+ goal = date + distances.min * IceCube::ONE_DAY
48
48
  adjust(goal, date)
49
49
  end
50
50
 
@@ -32,7 +32,7 @@ module DayOfWeekValidation
32
32
  def closest_day_of_week(date)
33
33
  return nil if !@validations[:day_of_week] || @validations[:day_of_week].empty?
34
34
  goal = date
35
- while goal += ONE_DAY
35
+ while goal += IceCube::ONE_DAY
36
36
  test = adjust(goal, date)
37
37
  return test if validate_day_of_week(test)
38
38
  end
@@ -44,7 +44,7 @@ module DayOfYearValidation
44
44
  distances = distances.select { |d| d > 0 }
45
45
  return nil if distances.empty?
46
46
  # return the start of the proper day
47
- goal = date + distances.min * ONE_DAY
47
+ goal = date + distances.min * IceCube::ONE_DAY
48
48
  adjust(goal, date)
49
49
  end
50
50
 
@@ -28,7 +28,7 @@ module HourOfDayValidation
28
28
  hours.compact!
29
29
  # go to the closest distance away, the start of that hour
30
30
  closest_hour = hours.min
31
- goal = date + ONE_HOUR * closest_hour
31
+ goal = date + IceCube::ONE_HOUR * closest_hour
32
32
  adjust(goal, date)
33
33
  end
34
34
 
@@ -28,7 +28,7 @@ module MinuteOfHourValidation
28
28
  minutes.compact!
29
29
  # go to the closest distance away, the beginning of that minute
30
30
  closest_minute = minutes.min
31
- goal = date + closest_minute * ONE_MINUTE
31
+ goal = date + closest_minute * IceCube::ONE_MINUTE
32
32
  adjust(goal, date)
33
33
  end
34
34
 
@@ -32,7 +32,7 @@ module MonthOfYearValidation
32
32
  months.compact!
33
33
  # go to the closest distance away
34
34
  goal = date
35
- months.min.times { goal += TimeUtil.days_in_month(goal) * ONE_DAY }
35
+ months.min.times { goal += TimeUtil.days_in_month(goal) * IceCube::ONE_DAY }
36
36
  adjust(goal, date)
37
37
  end
38
38
 
data/lib/ice_cube.rb CHANGED
@@ -29,10 +29,10 @@ module IceCube
29
29
 
30
30
  VERSION = '0.2.3'
31
31
 
32
- ONE_DAY = 24 * 60 * 60
33
- ONE_HOUR = 60 * 60
34
- ONE_MINUTE = 60
35
- ONE_SECOND = 1
32
+ IceCube::ONE_DAY = 24 * 60 * 60
33
+ IceCube::ONE_HOUR = 60 * 60
34
+ IceCube::ONE_MINUTE = 60
35
+ IceCube::ONE_SECOND = 1
36
36
 
37
37
  ICAL_DAYS = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA']
38
38
  DAYS = { :sunday => 0, :monday => 1, :tuesday => 2, :wednesday => 3, :thursday => 4, :friday => 5, :saturday => 6 }
metadata CHANGED
@@ -6,7 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 2
8
8
  - 3
9
- version: 0.2.3
9
+ - 1
10
+ version: 0.2.3.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - John Crepezzi