ice_cube 0.2.10 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,10 @@ module IceCube
18
18
  find_occurrences { |roc| false }
19
19
  end
20
20
 
21
+ def between(begin_time, end_time)
22
+ find_occurrences { |roc| roc > end_time }.select { |d| d >= begin_time }
23
+ end
24
+
21
25
  def upto(end_date)
22
26
  find_occurrences { |roc| roc > end_date }
23
27
  end
@@ -37,12 +37,23 @@ module IceCube
37
37
  from_hash(YAML::load(str))
38
38
  end
39
39
 
40
- # Determine whether a given date adheres to the ruleset of this schedule.
41
- def occurs_on?(date)
40
+ # Determine whether a given time adheres to the ruleset of this schedule.
41
+ def occurs_at?(date)
42
42
  dates = occurrences(date)
43
43
  dates.last == date
44
44
  end
45
45
 
46
+ # Determine whether a given date appears in the times returned by the schedule
47
+ # Required activeSupport
48
+ def occurs_on?(date)
49
+ time = date.to_time
50
+ occurrences_between(time.beginning_of_day, time.end_of_day).any?
51
+ end
52
+
53
+ def occurrences_between(begin_time, end_time)
54
+ find_occurrences { |head| head.between(begin_time, end_time) }
55
+ end
56
+
46
57
  # Return all possible occurrences
47
58
  # In order to make this call, all rules in the schedule must have
48
59
  # either an until date or an occurrence count
@@ -1,5 +1,5 @@
1
1
  module IceCube
2
2
 
3
- VERSION = "0.2.10"
3
+ VERSION = "0.2.11"
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
- - 10
9
- version: 0.2.10
8
+ - 11
9
+ version: 0.2.11
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-14 00:00:00 -04:00
17
+ date: 2010-04-15 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency