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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 452e1ff058496133e586d32e0bd5f697142627554871d43d2f76411faca50fed
4
- data.tar.gz: 2a337cd8865b7c8cbb2a43c2c3771b1422dc8872af4f21f23d2db3dc96469d11
3
+ metadata.gz: baf51ec40d00667e28eb581adff1478e77cf5e34d40ea05ab0348ba3d0f300bb
4
+ data.tar.gz: 924a021e7fe2f18da64d7c73c1d277e71c27c326d4c9dc5cd7887067e53e6ff1
5
5
  SHA512:
6
- metadata.gz: 650a891fdeee67ea1f78cca8eed34037cfdfb3628fc4bf36db5af70c4c2633133c9c28e00e4b4b3251881c847e223a03587995870cd78c72864cef18d224c290
7
- data.tar.gz: 53722f292ed892e0652199e43197fce1f670ac973f5a3a35bd3f6342f66681586ef0802adda21d4a4379b8a55c56eb1a5d2f5994ca976aafadb6be45125cbe89
6
+ metadata.gz: d5b06b32d3a4553159745cc5f75ba4d67ac7756be4caa2225e02a45784c7a02f022b2c1a29a95d615956e50299b6a65618ec538752c7ec878605ef49d815c4d1
7
+ data.tar.gz: fc4980d4d436db145a6e7e5f40cf25f50f3e5fa4919e6a2976ffacebbbe7486dd26747dc7f051805abf671307975afadcb5453952ba64fa91520bebb960eb7db
@@ -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
- rescue OnCalendar::Segment::Error => e
237
- raise Error, e
238
- end
239
- if parsed.nil?
240
- # We are a wild card
241
- conditions[idx] = [OnCalendar::Condition.const_get(klass).new(wildcard: true)]
242
- else
243
- # Lets build conditions with parsed
244
- conditions[idx] = []
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnCalendar
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: on_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Passmore