on_calendar 0.1.1 → 0.1.3
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.
- checksums.yaml +4 -4
- data/lib/on_calendar/parser.rb +12 -11
- data/lib/on_calendar/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: baf51ec40d00667e28eb581adff1478e77cf5e34d40ea05ab0348ba3d0f300bb
|
|
4
|
+
data.tar.gz: 924a021e7fe2f18da64d7c73c1d277e71c27c326d4c9dc5cd7887067e53e6ff1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5b06b32d3a4553159745cc5f75ba4d67ac7756be4caa2225e02a45784c7a02f022b2c1a29a95d615956e50299b6a65618ec538752c7ec878605ef49d815c4d1
|
|
7
|
+
data.tar.gz: fc4980d4d436db145a6e7e5f40cf25f50f3e5fa4919e6a2976ffacebbbe7486dd26747dc7f051805abf671307975afadcb5453952ba64fa91520bebb960eb7db
|
data/lib/on_calendar/parser.rb
CHANGED
|
@@ -135,6 +135,7 @@ module OnCalendar
|
|
|
135
135
|
|
|
136
136
|
def parse(expression)
|
|
137
137
|
raise OnCalendar::Parser::Error, "Expression must be a string" unless expression.is_a?(String)
|
|
138
|
+
raise OnCalendar::Parser::Error, "Expression cannot be empty" if expression.empty?
|
|
138
139
|
|
|
139
140
|
# Split string on white space and reverse
|
|
140
141
|
segments = expression.split.reverse
|
|
@@ -233,18 +234,18 @@ module OnCalendar
|
|
|
233
234
|
# Parse this segment
|
|
234
235
|
begin
|
|
235
236
|
parsed = OnCalendar::Segment.parse(segments.shift, max: max, min: min)
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
parsed.each do |c|
|
|
246
|
-
conditions[idx] << OnCalendar::Condition.const_get(klass).new(**c)
|
|
237
|
+
if parsed.nil?
|
|
238
|
+
# We are a wild card
|
|
239
|
+
conditions[idx] = [OnCalendar::Condition.const_get(klass).new(wildcard: true)]
|
|
240
|
+
else
|
|
241
|
+
# Lets build conditions with parsed
|
|
242
|
+
conditions[idx] = []
|
|
243
|
+
parsed.each do |c|
|
|
244
|
+
conditions[idx] << OnCalendar::Condition.const_get(klass).new(**c)
|
|
245
|
+
end
|
|
247
246
|
end
|
|
247
|
+
rescue OnCalendar::Segment::Error, OnCalendar::Condition::Error => e
|
|
248
|
+
raise Error, e
|
|
248
249
|
end
|
|
249
250
|
end
|
|
250
251
|
conditions
|
data/lib/on_calendar/version.rb
CHANGED