ice_cube 0.8.0 → 0.8.1

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.
@@ -34,7 +34,7 @@ module IceCube
34
34
  autoload :WeeklyRule, 'ice_cube/rules/weekly_rule'
35
35
  autoload :MonthlyRule, 'ice_cube/rules/monthly_rule'
36
36
  autoload :YearlyRule, 'ice_cube/rules/yearly_rule'
37
-
37
+
38
38
  module Validations
39
39
 
40
40
  autoload :Lock, 'ice_cube/validations/lock'
@@ -69,11 +69,18 @@ module IceCube
69
69
  ONE_DAY = ONE_HOUR * 24
70
70
  ONE_WEEK = ONE_DAY * 7
71
71
 
72
- # Formatting
73
- TO_S_TIME_FORMAT = '%B %e, %Y'
74
-
75
72
  def self.use_psych?
76
73
  @use_psych ||= defined?(Psych) && defined?(Psych::VERSION)
77
74
  end
78
75
 
76
+ # Defines the format used by IceCube when printing out Schedule#to_s.
77
+ # Defaults to '%B %e, %Y'
78
+ def self.to_s_time_format
79
+ @to_s_time_format ||= '%B %e, %Y'
80
+ end
81
+
82
+ # Sets the format used by IceCube when printing out Schedule#to_s.
83
+ def self.to_s_time_format=(format)
84
+ @to_s_time_format = format
85
+ end
79
86
  end
@@ -10,7 +10,7 @@ module IceCube
10
10
  attr_accessor :start_time
11
11
  deprecated_alias :start_date, :start_time
12
12
  deprecated_alias :start_date=, :start_time=
13
-
13
+
14
14
  # Get the duration
15
15
  attr_accessor :duration
16
16
 
@@ -239,11 +239,11 @@ module IceCube
239
239
  def to_s
240
240
  pieces = []
241
241
  ed = extimes; rd = rtimes - ed
242
- pieces.concat rd.sort.map { |t| t.strftime(TO_S_TIME_FORMAT) }
242
+ pieces.concat rd.sort.map { |t| t.strftime(IceCube.to_s_time_format) }
243
243
  pieces.concat rrules.map { |t| t.to_s }
244
244
  pieces.concat exrules.map { |t| "not #{t.to_s}" }
245
- pieces.concat ed.sort.map { |t| "not on #{t.strftime(TO_S_TIME_FORMAT)}" }
246
- pieces << "until #{end_time.strftime(TO_S_TIME_FORMAT)}" if end_time
245
+ pieces.concat ed.sort.map { |t| "not on #{t.strftime(IceCube.to_s_time_format)}" }
246
+ pieces << "until #{end_time.strftime(IceCube.to_s_time_format)}" if end_time
247
247
  pieces.join(' / ')
248
248
  end
249
249
 
@@ -47,12 +47,13 @@ module IceCube
47
47
  # Prevent a non-matching infinite loop
48
48
  return nil if closing_time && time > closing_time
49
49
  end
50
- # NOTE Uses may be 1 higher than proper here since end_time isn't validated
51
- # in this class. This is okay now, since we never expose it - but if we ever
52
- # do - we should check that above this line, and return nil if end_time is past
50
+ # NOTE Uses may be 1 higher than proper here since end_time isn't
51
+ # validated in this class. This is okay now, since we never expose it -
52
+ # but if we ever do - we should check that above this line, and return
53
+ # nil if end_time is past
53
54
  @uses += 1 if time
54
55
  time
55
- end
56
+ end
56
57
 
57
58
  def to_s
58
59
  builder = StringBuilder.new
@@ -37,7 +37,7 @@ module IceCube
37
37
  end
38
38
 
39
39
  def build_s(builder)
40
- builder.piece(:until) << "until #{time.strftime(TO_S_TIME_FORMAT)}"
40
+ builder.piece(:until) << "until #{time.strftime(IceCube.to_s_time_format)}"
41
41
  end
42
42
 
43
43
  def validate(t, schedule)
@@ -1,5 +1,5 @@
1
1
  module IceCube
2
2
 
3
- VERSION = '0.8.0'
3
+ VERSION = '0.8.1'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ice_cube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-25 00:00:00.000000000Z
12
+ date: 2012-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70300114106600 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70300114106600
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: active_support
27
- requirement: &70300114105840 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 3.0.0
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70300114105840
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 3.0.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: tzinfo
38
- requirement: &70300114105260 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,7 +53,12 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70300114105260
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  description: ice_cube is a recurring date library for Ruby. It allows for quick,
48
63
  programatic expansion of recurring date rules.
49
64
  email: john@crepezzi.com
@@ -111,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
126
  version: '0'
112
127
  requirements: []
113
128
  rubyforge_project: ice-cube
114
- rubygems_version: 1.8.17
129
+ rubygems_version: 1.8.24
115
130
  signing_key:
116
131
  specification_version: 3
117
132
  summary: Ruby Date Recurrence Library