opening_hours_converter 1.7.19 → 1.7.20
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: 6f84dd0e31e985cbb8d0e31d6b2da2dc54c4667555daf22277e31fa26fe72e3c
|
4
|
+
data.tar.gz: 0aa24ec1f8b071578f592bd330725d8c18e27fa4a2869af82e75f41f332c3c49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b029e0e307dad79447d7834a674d0555b5b8a9690aa23ca9b4d1763ef4d1379184a822d97051a15963eb97c8d3a8fef9955de708dad2bfeb0d42951c143ec85
|
7
|
+
data.tar.gz: 27a803a86bf8d3affc16ae04c554b837038c0b03c96cc68b1a37bc2808450f14c5e65bf90c8a858e009134973f3df45b16bb58defc595c3d01b0e8c1ba0ca1d2
|
@@ -120,18 +120,14 @@ module OpeningHoursConverter
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
+
|
123
124
|
result = ""
|
124
125
|
if rules.length == 0
|
125
126
|
date_ranges.each do |dr|
|
126
127
|
result += "#{dr.wide_interval.get_time_selector} off"
|
127
128
|
end
|
128
129
|
else
|
129
|
-
rules.
|
130
|
-
if rule_index > 0
|
131
|
-
result += "; "
|
132
|
-
end
|
133
|
-
result += rule.get
|
134
|
-
end
|
130
|
+
result += rules.map(&:get).join('; ')
|
135
131
|
end
|
136
132
|
|
137
133
|
return result.strip
|
@@ -18,63 +18,18 @@ module OpeningHoursConverter
|
|
18
18
|
for day in 0..interval.day_end
|
19
19
|
start_minute = 0
|
20
20
|
end_minute = (day == interval.day_end) ? interval.end : MINUTES_MAX
|
21
|
-
|
22
|
-
if start_minute && end_minute
|
23
|
-
for minute in 0..MINUTES_MAX
|
24
|
-
minute_array[day][minute] = "off"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
else
|
28
|
-
if start_minute && end_minute
|
29
|
-
if minute_array[day][0] == "off"
|
30
|
-
minute_array[day] = Array.new(MINUTES_MAX + 1, false)
|
31
|
-
end
|
32
|
-
for minute in start_minute..end_minute
|
33
|
-
minute_array[day][minute] = true
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
21
|
+
set_minute_array_for_interval(interval, minute_array, start_minute, end_minute, day)
|
37
22
|
end
|
38
23
|
for day in interval.day_start..6
|
39
24
|
start_minute = (day == interval.day_start) ? interval.start : 0
|
40
25
|
end_minute = MINUTES_MAX
|
41
|
-
|
42
|
-
if start_minute && end_minute
|
43
|
-
for minute in 0..MINUTES_MAX
|
44
|
-
minute_array[day][minute] = "off"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
else
|
48
|
-
if start_minute && end_minute
|
49
|
-
if minute_array[day][0] == "off"
|
50
|
-
minute_array[day] = Array.new(MINUTES_MAX + 1, false)
|
51
|
-
end
|
52
|
-
for minute in start_minute..end_minute
|
53
|
-
minute_array[day][minute] = true
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
26
|
+
set_minute_array_for_interval(interval, minute_array, start_minute, end_minute, day)
|
57
27
|
end
|
58
28
|
else
|
59
29
|
for day in interval.day_start..interval.day_end
|
60
30
|
start_minute = (day == interval.day_start) ? interval.start : 0
|
61
31
|
end_minute = (day == interval.day_end) ? interval.end : MINUTES_MAX
|
62
|
-
|
63
|
-
if start_minute && end_minute
|
64
|
-
for minute in 0..MINUTES_MAX
|
65
|
-
minute_array[day][minute] = "off"
|
66
|
-
end
|
67
|
-
end
|
68
|
-
else
|
69
|
-
if start_minute && end_minute
|
70
|
-
if minute_array[day][0] == "off"
|
71
|
-
minute_array[day] = Array.new(MINUTES_MAX + 1, false)
|
72
|
-
end
|
73
|
-
for minute in start_minute..end_minute
|
74
|
-
minute_array[day][minute] = true
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
32
|
+
set_minute_array_for_interval(interval, minute_array, start_minute, end_minute, day)
|
78
33
|
end
|
79
34
|
end
|
80
35
|
end
|
@@ -83,6 +38,25 @@ module OpeningHoursConverter
|
|
83
38
|
minute_array
|
84
39
|
end
|
85
40
|
|
41
|
+
def set_minute_array_for_interval(interval, minute_array, start_minute, end_minute, day)
|
42
|
+
if interval.is_off
|
43
|
+
if start_minute && end_minute
|
44
|
+
for minute in 0..MINUTES_MAX
|
45
|
+
minute_array[day][minute] = "off"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
else
|
49
|
+
if start_minute && end_minute
|
50
|
+
if minute_array[day][0] == "off"
|
51
|
+
minute_array[day] = Array.new(MINUTES_MAX + 1, false)
|
52
|
+
end
|
53
|
+
for minute in start_minute..end_minute
|
54
|
+
minute_array[day][minute] = true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
86
60
|
def get_intervals(clean=false)
|
87
61
|
if clean
|
88
62
|
minute_array = get_as_minute_array
|
@@ -166,7 +140,7 @@ module OpeningHoursConverter
|
|
166
140
|
if day_start >= 0 && self_minutes_array[d][m]
|
167
141
|
intervals[:open] << OpeningHoursConverter::Interval.new(day_start, min_start, d, m, off)
|
168
142
|
end
|
169
|
-
#
|
143
|
+
# other days and minutes
|
170
144
|
else
|
171
145
|
# new interval
|
172
146
|
if self_minutes_array[d][m] && day_start < 0
|
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.7.
|
4
|
+
version: 1.7.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ziserman Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|