opening_hours_converter 1.4.7 → 1.4.8

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
  SHA1:
3
- metadata.gz: a42f2ea0d4978fdd0bd57b0689aa32c5e97c80a5
4
- data.tar.gz: 7e5f5dfa2d83574529b0f0caf53e307897cb4495
3
+ metadata.gz: b6234f068f81ea52f797c60e5b9d1fe4168c3db0
4
+ data.tar.gz: 6f321a2b43003793a5555ae5b6261d45211a01cc
5
5
  SHA512:
6
- metadata.gz: d5039fd24d5be117ff922b24bf7813efec96dd51c8710a0881be33fd50801a5bbee9842bfbdff3fe0a92a54f3f538a0c737b61ccdd41687e16be4234a51284e1
7
- data.tar.gz: 506aaaa469f3a809680ccdc7306c55eb06086e167ddeab1f66ed16f660c8f0f5d6ff09ed3478fa6d69da29be696a8f638a714ad607096727a366b7fac4fa2773
6
+ metadata.gz: 743880923601f5e4e6f441259b34c8079e95806aa2c84d93ad00083dbba7c8af13824345cdf06dd264982739f37c8e41707b13239b9c16636e38122b39e14a83
7
+ data.tar.gz: 2673cc2577b15fa397d5f1794674105febc752905bec0fc55488d304eec09da9fe6f4bbb5ec5b063c14fe1a5c95db1f6ba9b1157dd123525bd9f410aaef798ab
@@ -1,5 +1,5 @@
1
1
  require 'opening_hours_converter/constants'
2
-
2
+ require 'pry-nav'
3
3
  module OpeningHoursConverter
4
4
  class OpeningHoursBuilder
5
5
  include Constants
@@ -212,12 +212,6 @@ module OpeningHoursConverter
212
212
  day.add_weekday(last_same_day)
213
213
  result << day
214
214
  elsif same_day_count > 2
215
- for j in (index+1)...last_same_day do
216
- if days_status[j] == 0
217
- days_status[j] = -index -1
218
- day.add_overwritten_weekday(j)
219
- end
220
- end
221
215
  day.add_weekday(last_same_day)
222
216
  result << day
223
217
  end
@@ -304,11 +298,13 @@ module OpeningHoursConverter
304
298
 
305
299
  end
306
300
  end
301
+ binding.pry
307
302
  result = merge_days(result)
308
303
  return result
309
304
  end
310
305
 
311
306
  def merge_days(rules)
307
+ binding.pry
312
308
  return rules if rules.length == 0
313
309
  result = []
314
310
  result << rules[0]
@@ -187,23 +187,24 @@ module OpeningHoursConverter
187
187
  end
188
188
  end
189
189
  else
190
- str_result += "#{selector} "
190
+ local_str = "#{selector} "
191
191
  intervals.each do |interval|
192
192
  if is_full_year?(interval)
193
193
  elsif is_full_month?(interval)
194
- str_result += "#{str_result.length > 5 ? "," : ""}#{OSM_MONTHS[interval[:start][:month]]}"
194
+ local_str += "#{local_str.length > 5 ? "," : ""}#{OSM_MONTHS[interval[:start][:month]]}"
195
195
  elsif starts_month?(interval) && ends_month?(interval)
196
- str_result += "#{str_result.length > 5 ? "," : ""}#{OSM_MONTHS[interval[:start][:month]]}-#{OSM_MONTHS[interval[:end][:month]]}"
196
+ local_str += "#{local_str.length > 5 ? "," : ""}#{OSM_MONTHS[interval[:start][:month]]}-#{OSM_MONTHS[interval[:end][:month]]}"
197
197
  elsif is_same_month?(interval)
198
198
  if is_same_day?(interval)
199
- str_result += "#{str_result.length > 5 ? "," : ""}#{OSM_MONTHS[interval[:start][:month]]} #{interval[:start][:day]+1 < 10 ? "0#{interval[:start][:day]+1}" : interval[:start][:day]+1}"
199
+ 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}"
200
200
  else
201
- str_result += "#{str_result.length > 5 ? "," : ""}#{OSM_MONTHS[interval[:start][:month]]} #{interval[:start][:day]+1 < 10 ? "0#{interval[:start][:day]+1}" : interval[:start][:day]+1}-#{interval[:end][:day]+1 < 10 ? "0#{interval[:end][:day]+1}" : interval[:end][:day]+1}"
201
+ 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}-#{interval[:end][:day]+1 < 10 ? "0#{interval[:end][:day]+1}" : interval[:end][:day]+1}"
202
202
  end
203
203
  else
204
- str_result += "#{str_result.length > 5 ? "," : ""}#{OSM_MONTHS[interval[:start][:month]]} #{interval[:start][:day]+1 < 10 ? "0#{interval[:start][:day]+1}" : interval[:start][:day]+1}-#{OSM_MONTHS[interval[:end][:month]]} #{interval[:end][:day]+1 < 10 ? "0#{interval[:end][:day]+1}" : interval[:end][:day]+1}"
204
+ 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}-#{OSM_MONTHS[interval[:end][:month]]} #{interval[:end][:day]+1 < 10 ? "0#{interval[:end][:day]+1}" : interval[:end][:day]+1}"
205
205
  end
206
206
  end
207
+ str_result += "#{str_result.length > 0 ? ", " : ""}#{local_str}"
207
208
  end
208
209
  end
209
210
 
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.7
4
+ version: 1.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ziserman Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2017-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json