opening_hours_converter 1.9.3 → 1.10.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: 684e901a145245d2884ed3cb350d887385efc2b39cc8402e2251216f3a49ff9d
|
4
|
+
data.tar.gz: a51144324b7af7a323b25a6634c8f8e5e3edcfcdbeb12ca1ad2b50ac3d830488
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef452a46a37394b827a8e8c36e7ecfb1b2d40cc3d8da4461730a933c81aea679ed4ddc40d486563c7fa37834899d4d385786b9792ac850f3c14c369bbdcc5e68
|
7
|
+
data.tar.gz: d3db0f40cee5804148039f76a662de2ff4696f7986365f9875007899a6f2ff733d845e1682f0c890c74cb0a9c6618e3776825036695cdcb32ea55d0862d2ed55
|
@@ -27,6 +27,7 @@ module OpeningHoursConverter
|
|
27
27
|
@RGX_YEAR_WEEK = /^(\d{4})(\-(\d{4}))? week ([01234]?[0-9]|5[0123])(\-([01234]?[0-9]|5[0123]))?(, ?([01234]?[0-9]|5[0123])(\-([01234]?[0-9]|5[0123]))?)*\:?$/
|
28
28
|
@RGX_YEAR_WEEK_WITH_MODIFIER = /^(\d{4})(\-(\d{4}))? week ([01234]?[0-9]|5[0123])(\-([01234]?[0-9]|5[0123])(\/[1-9])?)?(, ?([01234]?[0-9]|5[0123])(\-([01234]?[0-9]|5[0123])(\/[1-9])?)?)*$/
|
29
29
|
@RGX_YEAR_MONTH_DAY = /^(\d{4}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([012]?[0-9]|3[01])(\-((\d{4}) )?((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) )?([012]?[0-9]|3[01]))?\:?$/
|
30
|
+
@RGX_YEAR_MULTI_MONTH_DAY = /^(\d{4}) ((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([012]?[0-9]|3[01]),?)*?$/
|
30
31
|
@RGX_YEAR_MONTH = /^(\d{4}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(\-((\d{4}) )?((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)))?\:?$/
|
31
32
|
@RGX_COMMENT = /^\"[^\"]*\"$/
|
32
33
|
end
|
@@ -130,6 +131,8 @@ module OpeningHoursConverter
|
|
130
131
|
months << get_month(wide_range_selector)
|
131
132
|
elsif !(@RGX_YEAR =~ wide_range_selector).nil?
|
132
133
|
years << get_year(wide_range_selector)
|
134
|
+
elsif !(@RGX_YEAR_MULTI_MONTH_DAY =~ wide_range_selector).nil?
|
135
|
+
months += get_year_multi_month_day(wide_range_selector)
|
133
136
|
elsif !(@RGX_YEAR_WEEK_WITH_MODIFIER =~ wide_range_selector).nil?
|
134
137
|
weeks << get_year_week_with_modifier(wide_range_selector)
|
135
138
|
elsif !(@RGX_YEAR_WEEK =~ wide_range_selector).nil?
|
@@ -512,6 +515,20 @@ module OpeningHoursConverter
|
|
512
515
|
{ from_day: year_month_day_from, to_day: year_month_day_to }
|
513
516
|
end
|
514
517
|
|
518
|
+
def get_year_multi_month_day(wrs)
|
519
|
+
year = wrs[0...4]
|
520
|
+
wrs = wrs[5..wrs.length]
|
521
|
+
|
522
|
+
wrs.split(',').map do |wr|
|
523
|
+
from = {
|
524
|
+
year: year.to_i,
|
525
|
+
month: OSM_MONTHS.find_index(wr[0...3]) + 1,
|
526
|
+
day: wr[4...wr.length].to_i
|
527
|
+
}
|
528
|
+
{ from_day: from, to_day: from }
|
529
|
+
end
|
530
|
+
end
|
531
|
+
|
515
532
|
def get_times(time_selector)
|
516
533
|
times = []
|
517
534
|
from = nil
|
@@ -791,6 +808,9 @@ module OpeningHoursConverter
|
|
791
808
|
def is_year_week_with_modifier?(token)
|
792
809
|
!(@RGX_YEAR_WEEK_WITH_MODIFIER =~ token).nil?
|
793
810
|
end
|
811
|
+
def is_year_multi_month_day?(token)
|
812
|
+
!(@RGX_YEAR_MULTI_MONTH_DAY =~ token).nil?
|
813
|
+
end
|
794
814
|
end
|
795
815
|
end
|
796
816
|
|
@@ -168,6 +168,7 @@ module OpeningHoursConverter
|
|
168
168
|
end
|
169
169
|
end
|
170
170
|
str_result += local_str
|
171
|
+
local_str = ''
|
171
172
|
else
|
172
173
|
result.each do |selector, intervals|
|
173
174
|
if selector == 'always'
|
@@ -215,6 +216,7 @@ module OpeningHoursConverter
|
|
215
216
|
local_str += "#{local_str.length > 5 ? ',' : ''}#{OSM_MONTHS[interval[:start][:month]]} #{interval[:start][:day] + 1 < 10 ? "0#{interval[:start][:day] + 1}" : interval[:start][:day] + 1}-#{selector} #{OSM_MONTHS[interval[:end][:month]]} #{interval[:end][:day] + 1 < 10 ? "0#{interval[:end][:day] + 1}" : interval[:end][:day] + 1}"
|
216
217
|
end
|
217
218
|
str_result += "#{!str_result.empty? ? ',' : ''}#{local_str}"
|
219
|
+
local_str = ''
|
218
220
|
end
|
219
221
|
end
|
220
222
|
end
|
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.10.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: 2019-06-
|
11
|
+
date: 2019-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|