ice_cube 0.3.1 → 0.3.2

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.
@@ -43,6 +43,33 @@ module IceCube
43
43
  from_hash(YAML::load(str))
44
44
  end
45
45
 
46
+ TIME_FORMAT = '%B %e, %Y'
47
+ SEPARATOR = ' / '
48
+
49
+ # use with caution
50
+ # incomplete and not entirely tested - no time representation in dates
51
+ # there's a lot that can happen here
52
+ def to_s
53
+ representation = ''
54
+ inc_dates = @rdates - @exdates
55
+ if inc_dates && !inc_dates.empty?
56
+ representation << inc_dates.map { |d| d.strftime(TIME_FORMAT) }.join(SEPARATOR)
57
+ end
58
+ if @rrule_occurrence_heads && !@rrule_occurrence_heads.empty?
59
+ representation << SEPARATOR unless representation.empty?
60
+ representation << @rrule_occurrence_heads.map{ |r| r.rule.to_s }.join(SEPARATOR)
61
+ end
62
+ if @exrule_occurrence_heads && !@exrule_occurrence_heads.empty?
63
+ representation << SEPARATOR unless representation.empty?
64
+ representation << @exrule_occurrence_heads.map { |r| 'not ' << r.to_s }.join(SEPARATOR)
65
+ end
66
+ if @exdates && !@exdates.empty?
67
+ representation << SEPARATOR unless representation.empty?
68
+ representation << @exdates.map { |d| 'not on ' << d.strftime(TIME_FORMAT) }.join(SEPARATOR)
69
+ end
70
+ representation
71
+ end
72
+
46
73
  # Determine whether a given time adheres to the ruleset of this schedule.
47
74
  def occurs_at?(date)
48
75
  dates = occurrences(date)
@@ -1,5 +1,5 @@
1
1
  module IceCube
2
2
 
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
 
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
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-26 00:00:00 -04:00
17
+ date: 2010-04-27 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency