hiccup 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/hiccup.gemspec +1 -1
- data/lib/hiccup/core_ext/{fixnum.rb → integer.rb} +1 -1
- data/lib/hiccup/enumerable/monthly_enumerator.rb +1 -1
- data/lib/hiccup/humanizable.rb +1 -1
- data/lib/hiccup/validatable.rb +4 -4
- data/lib/hiccup/version.rb +1 -1
- data/test/enumerable_test.rb +4 -4
- data/test/monthly_enumerator_test.rb +1 -1
- data/test/weekly_enumerator_test.rb +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 387f7c01d2222a097f3f217469826a82bb33ea56
|
4
|
+
data.tar.gz: cc3c8e31744ad0dd1e28a2a53213de5d1aed50f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40718f786db47800243fac9eaa637fafefa4fd4a6573bd20121272b3bd3d3dc4bd40833a79701fe21f6f5b59be9cc01ec5ad9e24d814d22996b0129ab18cd125
|
7
|
+
data.tar.gz: c4bf292ca44128f2d59b686b699adce465c78cd491641111271e1f99ca96530d7f818406742eb3956d83b3786b7974a12be6ba044a0ee4b38961600b0bd733b8
|
data/hiccup.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_dependency "builder"
|
19
19
|
|
20
20
|
s.add_development_dependency "ri_cal"
|
21
|
-
s.add_development_dependency "bundler"
|
21
|
+
s.add_development_dependency "bundler"
|
22
22
|
s.add_development_dependency "rake", "~> 10.0"
|
23
23
|
s.add_development_dependency "minitest-reporters"
|
24
24
|
s.add_development_dependency "minitest-reporters-turn_reporter"
|
@@ -7,7 +7,7 @@ module Hiccup
|
|
7
7
|
def self.for(schedule)
|
8
8
|
if schedule.monthly_pattern.empty?
|
9
9
|
NeverEnumerator
|
10
|
-
elsif schedule.monthly_pattern.all? { |occurrence|
|
10
|
+
elsif schedule.monthly_pattern.all? { |occurrence| Integer === occurrence }
|
11
11
|
MonthlyDateEnumerator
|
12
12
|
else
|
13
13
|
self
|
data/lib/hiccup/humanizable.rb
CHANGED
data/lib/hiccup/validatable.rb
CHANGED
@@ -68,10 +68,10 @@ module Hiccup
|
|
68
68
|
def valid_occurrence?(occurrence)
|
69
69
|
if occurrence.is_a?(Array)
|
70
70
|
i, wd = occurrence
|
71
|
-
Date::DAYNAMES.member?(wd) && i.is_a?(
|
71
|
+
Date::DAYNAMES.member?(wd) && i.is_a?(Integer) && ((i == -1) || (1..6).include?(i))
|
72
72
|
else
|
73
73
|
i = occurrence
|
74
|
-
i.is_a?(
|
74
|
+
i.is_a?(Integer) && ([-1] + (1..31).to_a).include?(i)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -86,7 +86,7 @@ module Hiccup
|
|
86
86
|
# ordinal, kind = occurrence
|
87
87
|
#
|
88
88
|
# errors.add(:kind, "is not a valid monthly occurrence kind") unless Date::DAYNAMES.member?(kind)
|
89
|
-
# if ordinal.is_a?(
|
89
|
+
# if ordinal.is_a?(Integer)
|
90
90
|
# errors.add(:ordinal, "is not a valid integer") unless (ordinal==-1) or (1..6).include?(ordinal)
|
91
91
|
# else
|
92
92
|
# errors.add(:ordinal, "is not an integer")
|
@@ -94,7 +94,7 @@ module Hiccup
|
|
94
94
|
# else
|
95
95
|
# ordinal = occurrence
|
96
96
|
#
|
97
|
-
# if ordinal.is_a?(
|
97
|
+
# if ordinal.is_a?(Integer)
|
98
98
|
# errors.add(:ordinal, "is not an integer between 1 and 31") unless (1..31).include?(ordinal)
|
99
99
|
# else
|
100
100
|
# errors.add(:ordinal, "is not an integer")
|
data/lib/hiccup/version.rb
CHANGED
data/test/enumerable_test.rb
CHANGED
@@ -260,8 +260,8 @@ class EnumerableTest < ActiveSupport::TestCase
|
|
260
260
|
:start_date => Date.new(2011, 1, 3),
|
261
261
|
:ends => true,
|
262
262
|
:end_date => Date.new(2011, 1, 31)})
|
263
|
-
|
264
|
-
|
263
|
+
assert_nil schedule.first_occurrence_before(Date.new(2011,1,3))
|
264
|
+
assert_nil schedule.first_occurrence_on_or_before(Date.new(2011,1,2))
|
265
265
|
assert_equal [], schedule.n_occurrences_before(10, Date.new(2011,1,3))
|
266
266
|
assert_equal [], schedule.n_occurrences_on_or_before(10, Date.new(2011,1,2))
|
267
267
|
end
|
@@ -281,8 +281,8 @@ class EnumerableTest < ActiveSupport::TestCase
|
|
281
281
|
:start_date => Date.new(2011, 1, 3),
|
282
282
|
:ends => true,
|
283
283
|
:end_date => Date.new(2011, 1, 31)})
|
284
|
-
|
285
|
-
|
284
|
+
assert_nil schedule.first_occurrence_after(Date.new(2011,1,31))
|
285
|
+
assert_nil schedule.first_occurrence_on_or_after(Date.new(2011,2, 1))
|
286
286
|
assert_equal [], schedule.occurrences_between(Date.new(2013, 9, 23), Date.new(2013, 9, 30))
|
287
287
|
end
|
288
288
|
|
@@ -160,7 +160,7 @@ class MonthlyEnumeratorTest < ActiveSupport::TestCase
|
|
160
160
|
should "always return nil" do
|
161
161
|
date = Date.new(2015, 2, 1)
|
162
162
|
enumerator = @schedule.enumerator.new(@schedule, date)
|
163
|
-
|
163
|
+
assert_nil enumerator.next
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
@@ -119,12 +119,12 @@ class WeeklyEnumeratorTest < ActiveSupport::TestCase
|
|
119
119
|
|
120
120
|
should "return nil for prev rather than raising an exception" do
|
121
121
|
enumerator = @schedule.enumerator.new(@schedule, Date.today)
|
122
|
-
|
122
|
+
assert_nil enumerator.prev
|
123
123
|
end
|
124
124
|
|
125
125
|
should "return nil for next rather than raising an exception" do
|
126
126
|
enumerator = @schedule.enumerator.new(@schedule, Date.today)
|
127
|
-
|
127
|
+
assert_nil enumerator.next
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiccup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,8 +185,8 @@ files:
|
|
185
185
|
- lib/hiccup/core_ext/date.rb
|
186
186
|
- lib/hiccup/core_ext/duration.rb
|
187
187
|
- lib/hiccup/core_ext/enumerable.rb
|
188
|
-
- lib/hiccup/core_ext/fixnum.rb
|
189
188
|
- lib/hiccup/core_ext/hash.rb
|
189
|
+
- lib/hiccup/core_ext/integer.rb
|
190
190
|
- lib/hiccup/enumerable.rb
|
191
191
|
- lib/hiccup/enumerable/annually_enumerator.rb
|
192
192
|
- lib/hiccup/enumerable/monthly_date_enumerator.rb
|