japan_etc 0.5.0 → 0.5.1

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: f0a3e79920fcb4ab65a45b6a32b0950b93c6e75be19251f8bcd9d4cda34ffe05
4
- data.tar.gz: 39decc5b2ec02b0ddb6920df5a262e9a0f06c5774023c924528570699c4030cf
3
+ metadata.gz: 670b30bf29dbabbe8811c7c81cdbad4933547a0ff137fa82219f095dcfa0bb4d
4
+ data.tar.gz: 94402a9ca0281c8d39e39302db03cc756c47dd7979867bcf4223fc82165c1e99
5
5
  SHA512:
6
- metadata.gz: c7e007305afd27097c2b6ede40a0ebc4b36a6e9064f656f90cc5efcd8a1ac4d1445bbb64e3b00abf122020ec2cbc6cc890c2c030a2dfb075550333e05d7fb1fb
7
- data.tar.gz: 137da8f4a89e25188ad46ad792e39bc1b2a677ca3ec2580efc5e9aaad105cff3ab957df1c66a455ac5cc0685d47cf343e683fc7f7015876756c6c5cdcfc5ed4f
6
+ metadata.gz: a1b7ad4978d015880789800884719cc767a65888f5479a224526f354167d249865c878158346b870eb8eb404634117f7bcebacd12daff75d0fa9d76ce87eb174
7
+ data.tar.gz: 40d865a917082deaf61cd8da0dd60cb3fe409b566575c34724adcc9809782d92487ee13e1ae53d20962cd08068f986d0fb6e7fa2bb39e21f7cc9ec15377fcde3
@@ -1218,8 +1218,8 @@ tollbooth_id,road_name,route_name,tollbooth_name,direction,entrance_or_exit,note
1218
1218
  10-049,東京外環自動車道,,外環三郷西,,,
1219
1219
  03-249,東京外環自動車道,,外環三郷西,,,
1220
1220
  03-260,東京外環自動車道,,外環三郷西,,,
1221
- 10-050,東京外環自動車道,,外環三郷東,,,2018/6/2より「三郷中央」へ名称変更
1222
- 03-259,東京外環自動車道,,外環三郷東,,,2018/6/2より「三郷中央」へ名称変更
1221
+ 10-050,東京外環自動車道,,三郷中央,,,
1222
+ 03-259,東京外環自動車道,,三郷中央,,,
1223
1223
  03-261,東京外環自動車道,,三郷中央,,,
1224
1224
  10-051,東京外環自動車道,,三郷南,,,
1225
1225
  03-251,東京外環自動車道,,三郷南,,,
@@ -1567,7 +1567,7 @@ tollbooth_id,road_name,route_name,tollbooth_name,direction,entrance_or_exit,note
1567
1567
  01-453,長野自動車道,,塩尻北,,,
1568
1568
  01-454,長野自動車道,,松本,,,
1569
1569
  01-461,長野自動車道,,梓川スマート,,,
1570
- 01-455,長野自動車道,,豊科,,,2012/10/7より「安曇野」へ名称変更
1570
+ 01-455,長野自動車道,,安曇野,,,
1571
1571
  01-456,長野自動車道,,麻績,,,
1572
1572
  01-449,長野自動車道,,姨捨スマート,,,
1573
1573
  04-797,新東名高速道路,,厚木南,,,
@@ -2389,9 +2389,9 @@ tollbooth_id,road_name,route_name,tollbooth_name,direction,entrance_or_exit,note
2389
2389
  03-568,京葉道路,,篠崎,上り,,
2390
2390
  03-569,京葉道路,,篠崎,下り,,
2391
2391
  03-571,京葉道路,,京葉JCT,上り,,
2392
- 03-570,京葉道路,,市川,上り,,2018/6/2より「京葉市川上り」へ名称変更
2393
- 03-572,京葉道路,,市川,上り,,2018/6/2より「京葉市川上り」へ名称変更
2394
- 03-573,京葉道路,,市川,下り,,2018/6/2より「京葉市川下り」へ名称変更
2392
+ 03-570,京葉道路,,京葉市川,上り,,
2393
+ 03-572,京葉道路,,京葉市川,上り,,
2394
+ 03-573,京葉道路,,京葉市川,下り,,
2395
2395
  03-077,京葉道路,,原木,,,
2396
2396
  03-576,京葉道路,,原木,上り,,
2397
2397
  03-575,京葉道路,,原木,下り,,
@@ -12,14 +12,14 @@ module JapanETC
12
12
  include Util
13
13
 
14
14
  # NEXCO East
15
- URL = 'https://www.driveplaza.com/traffic/tolls_etc/etc_area/pdf/all01.pdf'
15
+ # URL = 'https://www.driveplaza.com/traffic/tolls_etc/etc_area/pdf/all01.pdf'
16
16
 
17
17
  # NEXCO Central
18
18
  # NOTE: This PDF has issues with text encoding
19
19
  # URL = 'https://highwaypost.c-nexco.co.jp/faq/etc/use/documents/etcriyoukanouic.pdf'
20
20
 
21
21
  # NEXCO West
22
- # URL = 'https://www.w-nexco.co.jp/etc/maintenance/pdfs/list01.pdf'
22
+ URL = 'https://www.w-nexco.co.jp/etc/maintenance/pdfs/list01.pdf'
23
23
 
24
24
  WHITESPACE = /[\s ]/.freeze
25
25
 
@@ -38,11 +38,7 @@ module JapanETC
38
38
  @notes = []
39
39
  notes << normalize(note) if note
40
40
 
41
- extract_notes_from_name!
42
- extract_direction_from_notes!
43
- extract_entrance_or_exit_from_notes!
44
- extract_direction_from_name!
45
- extract_entrance_or_exit_from_name!
41
+ normalize!
46
42
  end
47
43
 
48
44
  def initialize_copy(original)
@@ -71,6 +67,16 @@ module JapanETC
71
67
  ].flatten
72
68
  end
73
69
 
70
+ def normalize!
71
+ extract_notes_from_name!
72
+ extract_direction_from_notes!
73
+ extract_entrance_or_exit_from_notes!
74
+ extract_direction_from_name!
75
+ extract_entrance_or_exit_from_name!
76
+ name_was_changed = extract_name_from_notes!
77
+ normalize! if name_was_changed
78
+ end
79
+
74
80
  def extract_notes_from_name!
75
81
  name.sub!(/(?<head>.+?)?\s*[(\(](?<note>.+?)[)\)]\s*(?<tail>.+)?/) do
76
82
  match = Regexp.last_match
@@ -155,6 +161,19 @@ module JapanETC
155
161
  end
156
162
  end
157
163
 
164
+ def extract_name_from_notes!
165
+ name_was_changed = notes.reject! do |note|
166
+ match = note.match(/「(?<new_name>.+?)」へ名称変更/)
167
+ next false unless match
168
+
169
+ @name = normalize(match[:new_name])
170
+
171
+ true
172
+ end
173
+
174
+ name_was_changed
175
+ end
176
+
158
177
  def prepend_to_notes(note)
159
178
  note = normalize(note)
160
179
  notes.prepend(note)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JapanETC
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: japan_etc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Nakayama