opening_hours_converter 1.13.11 → 1.13.12

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: 429a62958899aeaee2bc229201b32db3f8e5c71ba3de00b35979f8d7f600051e
4
- data.tar.gz: 7f408d609dc038324dc31edfe72d306321e3cf87cb3fe6889524777a576c6865
3
+ metadata.gz: 6f7598eeb7cb6738f017cf1a785eb5afddcc90717575a5a489d3c4d797579988
4
+ data.tar.gz: 7ec00410febbdb1faa8c801dc23d1ab826a5d36035a449bfcd5df96475391ae0
5
5
  SHA512:
6
- metadata.gz: 7cbfcce4281b812116366f14d4ae9f28b421182d462373dcd40366cf7e95a4da71479e6d8809ebf230b2143d89d654213406686254e7de98e4bc3564d0f3ac9c
7
- data.tar.gz: 6e54d189cccf398a083e2283cffe41591ec3519a67dad77d92c8901504cf6284183a9e73b3b6e65c382c9a7a8c22916c9ad46467a9fdd462e8506888c52616dc
6
+ metadata.gz: 39efeed6fd42120adb95e32505c5654bc8ddea7471d612aea2f1051856b20dcdda5bced0678374c09f9c9f9c922dab8c3b755719fba6610d84b8bb1c40c7c9c1
7
+ data.tar.gz: b5d8e74cb8320c6d97a6690a8969bc5fafebef332c14885712321c37a49265c676eec278c9727497df0695fad7f0b52afda0e1118cf8415166c27dd796864661
@@ -445,6 +445,7 @@ module OpeningHoursConverter
445
445
  else
446
446
  month_to = nil
447
447
  end
448
+
448
449
  { from_day: month_from, to_day: month_to }
449
450
  end
450
451
 
@@ -550,25 +551,36 @@ module OpeningHoursConverter
550
551
  def get_multi_month(wrs)
551
552
  wrs.split(',').map do |wr|
552
553
  if wr.include?('-')
553
- start_month, end_month = wr.split('-')
554
+ start_month_day, end_month_day = wr.split('-')
555
+
556
+ start_month = start_month_day[0...3]
557
+ start_day = start_month_day[4...start_month_day.length]&.to_i
558
+
559
+ end_month = end_month_day[0...3]
560
+ end_day = end_month_day[4...end_month_day.length]&.to_i
561
+
554
562
  from = {
555
563
  month: OSM_MONTHS.find_index(start_month) + 1,
556
- day: 1
564
+ day: start_day || 1
557
565
  }
558
566
  to = {
559
567
  month: OSM_MONTHS.find_index(end_month) + 1,
560
- day: MONTH_END_DAY[OSM_MONTHS.find_index(end_month)]
568
+ day: end_day || MONTH_END_DAY[OSM_MONTHS.find_index(end_month)]
561
569
  }
562
570
  else
571
+ month = wr[0...3]
572
+ day = wr[4...wr.length]&.to_i
573
+
563
574
  from = {
564
- month: OSM_MONTHS.find_index(wr[0...3]) + 1,
565
- day: 1
575
+ month: OSM_MONTHS.find_index(month) + 1,
576
+ day: day || 1
566
577
  }
567
578
  to = {
568
- month: OSM_MONTHS.find_index(wr[0...3]) + 1,
569
- day: MONTH_END_DAY[OSM_MONTHS.find_index(wr[0...3])]
579
+ month: OSM_MONTHS.find_index(month) + 1,
580
+ day: day || MONTH_END_DAY[OSM_MONTHS.find_index(month)]
570
581
  }
571
582
  end
583
+
572
584
  { from_day: from, to_day: to }
573
585
  end
574
586
  end
@@ -178,7 +178,20 @@ module OpeningHoursConverter
178
178
  end
179
179
 
180
180
  def multi_month_regex
181
- compile(line(potential_list(potential_range(month))))
181
+ compile(
182
+ line(
183
+ potential_list(
184
+ potential_range(
185
+ month +
186
+ potential(
187
+ group(
188
+ space, potential_range(month_day)
189
+ )
190
+ )
191
+ )
192
+ )
193
+ )
194
+ )
182
195
  end
183
196
 
184
197
  def week_value_regex
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opening_hours_converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.11
4
+ version: 1.13.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ziserman Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-24 00:00:00.000000000 Z
11
+ date: 2020-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json