opening_hours_converter 1.13.17 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1840d4011474e210bb2248979afc8850829c4eab62b0cb2036a670a70ded1265
|
4
|
+
data.tar.gz: 0710a806e7ac90d3b61d83bd9281acb1c56546aabb504d8b4961f5eeb05ca1b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5160c41e2242e1489b1daddecef9068c3218d9726b7f6c0871176d323796035df2b1d491018b13506e88bbf33212df6549063a5ed81559ad645ac5e59a579962
|
7
|
+
data.tar.gz: 6e3c009bfb86cfda6a516ee4c86b49cc165211ee323981b20d74b778938249cb88a436601517659a4b17c8d4bc26119dec0e171ef94c6685094a9d8ee407ba6f
|
@@ -403,11 +403,11 @@ module OpeningHoursConverter
|
|
403
403
|
|
404
404
|
def get_month(wrs)
|
405
405
|
single_month = wrs.gsub(/\:$/, '').split('-')
|
406
|
-
month_from = OSM_MONTHS.find_index(single_month[0]) + 1
|
406
|
+
month_from = OSM_MONTHS.find_index(single_month[0].capitalize) + 1
|
407
407
|
raise ArgumentError, "Invalid month : #{single_month[0]}" if month_from < 1
|
408
408
|
|
409
409
|
if single_month.length > 1
|
410
|
-
month_to = OSM_MONTHS.find_index(single_month[1]) + 1
|
410
|
+
month_to = OSM_MONTHS.find_index(single_month[1].capitalize) + 1
|
411
411
|
raise ArgumentError, "Invalid month : #{single_month[1]}" if month_to < 1
|
412
412
|
else
|
413
413
|
month_to = month_from
|
@@ -435,13 +435,13 @@ module OpeningHoursConverter
|
|
435
435
|
single_month = wrs.gsub(/\:$/, '').split('-')
|
436
436
|
|
437
437
|
month_from = single_month[0].split(' ')
|
438
|
-
month_from = { day: month_from[1].to_i, month: OSM_MONTHS.find_index(month_from[0]) + 1 }
|
438
|
+
month_from = { day: month_from[1].to_i, month: OSM_MONTHS.find_index(month_from[0].capitalize) + 1 }
|
439
439
|
raise ArgumentError, "Invalid month : #{month_from.inspect}" if month_from[:month] < 1
|
440
440
|
|
441
441
|
if single_month.length > 1
|
442
442
|
month_to = single_month[1].split(' ')
|
443
443
|
month_to = if month_to.length > 1
|
444
|
-
{ day: month_to[1].to_i, month: OSM_MONTHS.find_index(month_to[0]) + 1 }
|
444
|
+
{ day: month_to[1].to_i, month: OSM_MONTHS.find_index(month_to[0].capitalize) + 1 }
|
445
445
|
else
|
446
446
|
{ day: month_to[0].to_i, month: month_from[:month] }
|
447
447
|
end
|
@@ -456,16 +456,16 @@ module OpeningHoursConverter
|
|
456
456
|
def get_year_month(wrs)
|
457
457
|
single_year_month = wrs.gsub(/\:$/, '').split('-')
|
458
458
|
year_month_from = single_year_month[0].split(' ')
|
459
|
-
year_month_from = { month: OSM_MONTHS.find_index(year_month_from[1]) + 1, year: year_month_from[0].to_i }
|
459
|
+
year_month_from = { month: OSM_MONTHS.find_index(year_month_from[1].capitalize) + 1, year: year_month_from[0].to_i }
|
460
460
|
if year_month_from.empty?
|
461
461
|
raise ArgumentError, "Invalid year_month : #{year_month_from.inspect}"
|
462
462
|
end
|
463
463
|
if single_year_month.length > 1
|
464
464
|
year_month_to = single_year_month[1].split(' ')
|
465
465
|
if year_month_to.length == 2
|
466
|
-
year_month_to = { month: OSM_MONTHS.find_index(year_month_to[1]) + 1, year: year_month_to[0].to_i }
|
466
|
+
year_month_to = { month: OSM_MONTHS.find_index(year_month_to[1].capitalize) + 1, year: year_month_to[0].to_i }
|
467
467
|
elsif year_month_to.length == 1
|
468
|
-
year_month_to = { month: OSM_MONTHS.find_index(year_month_to[0]) + 1, year: year_month_from[:year] }
|
468
|
+
year_month_to = { month: OSM_MONTHS.find_index(year_month_to[0].capitalize) + 1, year: year_month_from[:year] }
|
469
469
|
end
|
470
470
|
raise ArgumentError, "Invalid year_month : #{year_month_to.inspect}" if year_month_to.empty?
|
471
471
|
else
|
@@ -489,7 +489,7 @@ module OpeningHoursConverter
|
|
489
489
|
single_year_month_day = wrs.gsub(/\:$/, '').split('-')
|
490
490
|
year_month_day_from = single_year_month_day[0].split(' ')
|
491
491
|
year_month_day_from = { day: year_month_day_from[2].to_i,
|
492
|
-
month: OSM_MONTHS.find_index(year_month_day_from[1]) + 1,
|
492
|
+
month: OSM_MONTHS.find_index(year_month_day_from[1].capitalize) + 1,
|
493
493
|
year: year_month_day_from[0].to_i }
|
494
494
|
if year_month_day_from.empty?
|
495
495
|
raise ArgumentError, "Invalid year_month_day : #{year_month_day_from.inspect}"
|
@@ -498,11 +498,11 @@ module OpeningHoursConverter
|
|
498
498
|
year_month_day_to = single_year_month_day[1].split(' ')
|
499
499
|
if year_month_day_to.length == 3
|
500
500
|
year_month_day_to = { day: year_month_day_to[2].to_i,
|
501
|
-
month: OSM_MONTHS.find_index(year_month_day_to[1]) + 1,
|
501
|
+
month: OSM_MONTHS.find_index(year_month_day_to[1].capitalize) + 1,
|
502
502
|
year: year_month_day_to[0].to_i }
|
503
503
|
elsif year_month_day_to.length == 2
|
504
504
|
year_month_day_to = { day: year_month_day_to[1].to_i,
|
505
|
-
month: OSM_MONTHS.find_index(year_month_day_to[0]) + 1,
|
505
|
+
month: OSM_MONTHS.find_index(year_month_day_to[0].capitalize) + 1,
|
506
506
|
year: year_month_day_from[:year] }
|
507
507
|
elsif year_month_day_to.length == 1
|
508
508
|
year_month_day_to = { day: year_month_day_to[0].to_i,
|
@@ -532,12 +532,12 @@ module OpeningHoursConverter
|
|
532
532
|
if days.length == 2
|
533
533
|
from = {
|
534
534
|
year: year.to_i,
|
535
|
-
month: OSM_MONTHS.find_index(wr[0...3]) + 1,
|
535
|
+
month: OSM_MONTHS.find_index(wr[0...3].capitalize) + 1,
|
536
536
|
day: days[0]
|
537
537
|
}
|
538
538
|
to = {
|
539
539
|
year: year.to_i,
|
540
|
-
month: OSM_MONTHS.find_index(wr[0...3]) + 1,
|
540
|
+
month: OSM_MONTHS.find_index(wr[0...3].capitalize) + 1,
|
541
541
|
day: days[1]
|
542
542
|
}
|
543
543
|
{ from_day: from, to_day: to }
|
@@ -564,24 +564,24 @@ module OpeningHoursConverter
|
|
564
564
|
end_day = end_month_day[4...end_month_day.length]&.to_i
|
565
565
|
|
566
566
|
from = {
|
567
|
-
month: OSM_MONTHS.find_index(start_month) + 1,
|
567
|
+
month: OSM_MONTHS.find_index(start_month.capitalize) + 1,
|
568
568
|
day: start_day || 1
|
569
569
|
}
|
570
570
|
to = {
|
571
|
-
month: OSM_MONTHS.find_index(end_month) + 1,
|
572
|
-
day: end_day || MONTH_END_DAY[OSM_MONTHS.find_index(end_month)]
|
571
|
+
month: OSM_MONTHS.find_index(end_month.capitalize) + 1,
|
572
|
+
day: end_day || MONTH_END_DAY[OSM_MONTHS.find_index(end_month.capitalize)]
|
573
573
|
}
|
574
574
|
else
|
575
575
|
month = wr[0...3]
|
576
576
|
day = wr[4...wr.length]&.to_i
|
577
577
|
|
578
578
|
from = {
|
579
|
-
month: OSM_MONTHS.find_index(month) + 1,
|
579
|
+
month: OSM_MONTHS.find_index(month.capitalize) + 1,
|
580
580
|
day: day || 1
|
581
581
|
}
|
582
582
|
to = {
|
583
|
-
month: OSM_MONTHS.find_index(month) + 1,
|
584
|
-
day: day || MONTH_END_DAY[OSM_MONTHS.find_index(month)]
|
583
|
+
month: OSM_MONTHS.find_index(month.capitalize) + 1,
|
584
|
+
day: day || MONTH_END_DAY[OSM_MONTHS.find_index(month.capitalize)]
|
585
585
|
}
|
586
586
|
end
|
587
587
|
|
@@ -598,24 +598,24 @@ module OpeningHoursConverter
|
|
598
598
|
start_month, end_month = wr.split('-')
|
599
599
|
from = {
|
600
600
|
year: year.to_i,
|
601
|
-
month: OSM_MONTHS.find_index(start_month) + 1,
|
601
|
+
month: OSM_MONTHS.find_index(start_month.capitalize) + 1,
|
602
602
|
day: 1
|
603
603
|
}
|
604
604
|
to = {
|
605
605
|
year: year.to_i,
|
606
|
-
month: OSM_MONTHS.find_index(end_month) + 1,
|
607
|
-
day: MONTH_END_DAY[OSM_MONTHS.find_index(end_month)]
|
606
|
+
month: OSM_MONTHS.find_index(end_month.capitalize) + 1,
|
607
|
+
day: MONTH_END_DAY[OSM_MONTHS.find_index(end_month.capitalize)]
|
608
608
|
}
|
609
609
|
else
|
610
610
|
from = {
|
611
611
|
year: year.to_i,
|
612
|
-
month: OSM_MONTHS.find_index(wr[0...3]) + 1,
|
612
|
+
month: OSM_MONTHS.find_index(wr[0...3].capitalize) + 1,
|
613
613
|
day: 1
|
614
614
|
}
|
615
615
|
to = {
|
616
616
|
year: year.to_i,
|
617
|
-
month: OSM_MONTHS.find_index(wr[0...3]) + 1,
|
618
|
-
day: MONTH_END_DAY[OSM_MONTHS.find_index(wr[0...3])]
|
617
|
+
month: OSM_MONTHS.find_index(wr[0...3].capitalize) + 1,
|
618
|
+
day: MONTH_END_DAY[OSM_MONTHS.find_index(wr[0...3].capitalize)]
|
619
619
|
}
|
620
620
|
end
|
621
621
|
{ from_day: from, to_day: to }
|
@@ -657,9 +657,9 @@ module OpeningHoursConverter
|
|
657
657
|
elsif !(@regex_handler.week_day_regex =~ wd).nil?
|
658
658
|
single_weekday = wd.split('-')
|
659
659
|
|
660
|
-
wd_from = OSM_DAYS.find_index(single_weekday[0])
|
660
|
+
wd_from = OSM_DAYS.find_index(single_weekday[0].capitalize)
|
661
661
|
wd_to = if single_weekday.length > 1
|
662
|
-
OSM_DAYS.find_index(single_weekday[1])
|
662
|
+
OSM_DAYS.find_index(single_weekday[1].capitalize)
|
663
663
|
else
|
664
664
|
wd_from
|
665
665
|
end
|
@@ -670,8 +670,8 @@ module OpeningHoursConverter
|
|
670
670
|
from, to = wd[0...wd.index('[')].split('-')
|
671
671
|
index = wd[wd.index('[') + 1...wd.index(']')]
|
672
672
|
|
673
|
-
wd_from = OSM_DAYS.find_index(from)
|
674
|
-
wd_to = OSM_DAYS.find_index(to)
|
673
|
+
wd_from = OSM_DAYS.find_index(from.capitalize)
|
674
|
+
wd_to = OSM_DAYS.find_index(to.capitalize)
|
675
675
|
|
676
676
|
weekdays << { from: wd_from, to: wd_from, index: index.to_i }
|
677
677
|
else
|
@@ -23,15 +23,15 @@ module OpeningHoursConverter
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def weekday?
|
26
|
-
string? && OSM_DAYS.any? { |day| day == @value }
|
26
|
+
string? && OSM_DAYS.any? { |day| day.downcase == @value.downcase }
|
27
27
|
end
|
28
28
|
|
29
29
|
def month?
|
30
|
-
string? && OSM_MONTHS.any? { |day| day == @value }
|
30
|
+
string? && OSM_MONTHS.any? { |day| day.downcase == @value.downcase }
|
31
31
|
end
|
32
32
|
|
33
33
|
def week?
|
34
|
-
string? && @value == 'week'
|
34
|
+
string? && @value.downcase == 'week'
|
35
35
|
end
|
36
36
|
|
37
37
|
def week_index?
|
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.
|
4
|
+
version: 1.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ziserman Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06
|
11
|
+
date: 2022-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|