ice_cube 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
data/lib/ice_cube.rb
CHANGED
data/lib/ice_cube/rule.rb
CHANGED
@@ -139,13 +139,13 @@ module IceCube
|
|
139
139
|
#put days on the string, remove all occurrences in days from days_of_week
|
140
140
|
if days_dedup
|
141
141
|
@validations[:day_of_week].keys.each { |day| days_dedup.delete(day) } if @validations[:day_of_week]
|
142
|
-
representation << (days_dedup.map { |d| ICAL_DAYS[d]} ).join(',')
|
142
|
+
representation << (days_dedup.map { |d| IceCube::ICAL_DAYS[d]} ).join(',')
|
143
143
|
end
|
144
144
|
representation << ',' if days_dedup && @validations[:day_of_week]
|
145
145
|
#put days_of_week on string representation
|
146
146
|
representation << @validations[:day_of_week].inject([]) do |day_rules, pair|
|
147
147
|
day, occ = *pair
|
148
|
-
day_rules.concat(occ.map {|v| v.to_s + ICAL_DAYS[day]})
|
148
|
+
day_rules.concat(occ.map {|v| v.to_s + IceCube::ICAL_DAYS[day]})
|
149
149
|
end.flatten.join(',') if @validations[:day_of_week]
|
150
150
|
end
|
151
151
|
representation << ';BYHOUR=' << @validations[:hour_of_day].join(',') if @validations[:hour_of_day]
|
@@ -10,8 +10,8 @@ module DayValidation
|
|
10
10
|
def day(*days)
|
11
11
|
@validations[:day] ||= []
|
12
12
|
days.each do |day|
|
13
|
-
raise ArgumentError.new('Argument must be a valid day of the week') unless DAYS.has_key?(day)
|
14
|
-
@validations[:day] << DAYS[day]
|
13
|
+
raise ArgumentError.new('Argument must be a valid day of the week') unless IceCube::DAYS.has_key?(day)
|
14
|
+
@validations[:day] << IceCube::DAYS[day]
|
15
15
|
end
|
16
16
|
self
|
17
17
|
end
|
@@ -10,9 +10,9 @@ module DayOfWeekValidation
|
|
10
10
|
def day_of_week(days)
|
11
11
|
@validations[:day_of_week] ||= {}
|
12
12
|
days.each do |day, occurrences|
|
13
|
-
raise ArgumentError.new('Argument must be a valid day') unless DAYS.has_key?(day)
|
14
|
-
@validations[:day_of_week][DAYS[day]] ||= []
|
15
|
-
@validations[:day_of_week][DAYS[day]].concat(occurrences)
|
13
|
+
raise ArgumentError.new('Argument must be a valid day') unless IceCube::DAYS.has_key?(day)
|
14
|
+
@validations[:day_of_week][IceCube::DAYS[day]] ||= []
|
15
|
+
@validations[:day_of_week][IceCube::DAYS[day]].concat(occurrences)
|
16
16
|
end
|
17
17
|
self
|
18
18
|
end
|
@@ -11,8 +11,8 @@ module MonthOfYearValidation
|
|
11
11
|
def month_of_year(*months)
|
12
12
|
@validations[:month_of_year] ||= []
|
13
13
|
months.each do |month|
|
14
|
-
raise ArgumentError.new('Argument must be a valid month') unless MONTHS.has_key?(month)
|
15
|
-
@validations[:month_of_year] << MONTHS[month]
|
14
|
+
raise ArgumentError.new('Argument must be a valid month') unless IceCube::MONTHS.has_key?(month)
|
15
|
+
@validations[:month_of_year] << IceCube::MONTHS[month]
|
16
16
|
end
|
17
17
|
self
|
18
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ice_cube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 3
|
9
|
+
version: 0.2.3
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- John Crepezzi
|
@@ -9,19 +14,21 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-02 00:00:00 -04:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
23
29
|
version: "0"
|
24
|
-
|
30
|
+
type: :development
|
31
|
+
version_requirements: *id001
|
25
32
|
description: ice_cube is a recurring date library for Ruby. It allows for quick, programatic expansion of recurring date rules.
|
26
33
|
email: john@crepezzi.com
|
27
34
|
executables: []
|
@@ -64,18 +71,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
71
|
requirements:
|
65
72
|
- - ">="
|
66
73
|
- !ruby/object:Gem::Version
|
74
|
+
segments:
|
75
|
+
- 0
|
67
76
|
version: "0"
|
68
|
-
version:
|
69
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
78
|
requirements:
|
71
79
|
- - ">="
|
72
80
|
- !ruby/object:Gem::Version
|
81
|
+
segments:
|
82
|
+
- 0
|
73
83
|
version: "0"
|
74
|
-
version:
|
75
84
|
requirements: []
|
76
85
|
|
77
86
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.3.
|
87
|
+
rubygems_version: 1.3.6
|
79
88
|
signing_key:
|
80
89
|
specification_version: 3
|
81
90
|
summary: Ruby Date Recurrence Library
|