ice_cube_cron 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/lib/ice_cube_cron/version.rb +1 -1
- data/lib/ice_cube_ext/validations/year.rb +2 -2
- data/spec/lib/ice_cube_cron/base_spec.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4177ac895e629d1b81080c4fadb639109705eb5
|
4
|
+
data.tar.gz: 55c6f84a783a4d5d0e5cb27fe2b729809782860c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a1a73ec0d09f91490dde50e6de214c4cd53b1a22295dbd672e220da40b0af8f45c1722c274de0e24b715fa144f9fbac84ba6f47095ecb8bc83ee590e6cc6dea
|
7
|
+
data.tar.gz: 2bc4d36810f9d788217f6a82e81b4e1d22e0addfc3ced87dc5d402307c6ad7c4b300409cbf9e2b5a52972165ea7202a313ee10e56740a1232d447a7647f19ae2
|
data/README.md
CHANGED
@@ -41,7 +41,7 @@ Cron expression can be specified using a hash or a string in the format:
|
|
41
41
|
```ruby
|
42
42
|
require 'ice_cube_cron'
|
43
43
|
|
44
|
-
# using cron expression string
|
44
|
+
# using cron expression string
|
45
45
|
schedule = ::IceCube::Schedule.from_cron(::Date.current, "* * * * 5")
|
46
46
|
|
47
47
|
# using hash
|
@@ -70,4 +70,3 @@ schedule.occurrences_between(::Date.new(2015, 3, 5), ::Date.new(2015, 6, 5))
|
|
70
70
|
|
71
71
|
## todo
|
72
72
|
- Add support for time options
|
73
|
-
- Add support for string cron expressions
|
@@ -35,7 +35,7 @@ module IceCube
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def build_s(builder)
|
38
|
-
builder.piece(:year) <<
|
38
|
+
builder.piece(:year) << year
|
39
39
|
end
|
40
40
|
|
41
41
|
def build_hash(builder)
|
@@ -47,7 +47,7 @@ module IceCube
|
|
47
47
|
end
|
48
48
|
|
49
49
|
StringBuilder.register_formatter(:year) do |entries|
|
50
|
-
"in #{StringBuilder.sentence(entries)}
|
50
|
+
"in #{StringBuilder.sentence(entries)}"
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -243,6 +243,10 @@ describe ::IceCubeCron do
|
|
243
243
|
it '#occurrences_between' do
|
244
244
|
expect(ice_cube_model.occurrences_between(::Date.new(2013, 1, 1), ::Date.new(2017, 12, 31))).to eq([::Date.new(2015, 6, 10)])
|
245
245
|
end
|
246
|
+
|
247
|
+
it '#to_s' do
|
248
|
+
expect(ice_cube_model.to_s).to eq('Yearly in 2015 in June on the 10th day of the month')
|
249
|
+
end
|
246
250
|
end
|
247
251
|
|
248
252
|
context 'in a month of multiple years' do
|
@@ -258,6 +262,10 @@ describe ::IceCubeCron do
|
|
258
262
|
it '#occurrences_between' do
|
259
263
|
expect(ice_cube_model.occurrences_between(::Date.new(2013, 1, 1), ::Date.new(2018, 12, 31))).to eq([::Date.new(2015, 6, 10), ::Date.new(2017, 6, 10)])
|
260
264
|
end
|
265
|
+
|
266
|
+
it '#to_s' do
|
267
|
+
expect(ice_cube_model.to_s).to eq('Yearly in 2015 and 2017 in June on the 10th day of the month')
|
268
|
+
end
|
261
269
|
end
|
262
270
|
|
263
271
|
context 'multiple days in month of a year' do
|
@@ -273,6 +281,10 @@ describe ::IceCubeCron do
|
|
273
281
|
it '#occurrences_between' do
|
274
282
|
expect(ice_cube_model.occurrences_between(::Date.new(2013, 1, 1), ::Date.new(2017, 12, 31))).to eq([::Date.new(2015, 6, 10), ::Date.new(2015, 6, 15)])
|
275
283
|
end
|
284
|
+
|
285
|
+
it '#to_s' do
|
286
|
+
expect(ice_cube_model.to_s).to eq('Yearly in 2015 in June on the 10th and 15th days of the month')
|
287
|
+
end
|
276
288
|
end
|
277
289
|
end
|
278
290
|
end
|