japanese_address_parser 3.0.0 → 3.0.2

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: 72363aa74cf45e200716ce789f6755ea43b23b556d913a76cd4479e88c44e571
4
- data.tar.gz: 844e5565b51f6cb3d630b244d77c6197cbbc35e6f57015d807ef546173e03f59
3
+ metadata.gz: 555a4597440df04e4b0cc11e22af2a53914098e4088a505e03fb9ca416cc2e36
4
+ data.tar.gz: 0dd0bc8273ff38526422196b6cdc2117bb22b40bbbc9ea87880f64a8977b3a2d
5
5
  SHA512:
6
- metadata.gz: 780a695538d70fdded3cc8a2be167241f006fa4719658cb7d556d52911be7a91addb6fdea8a7989fcccd945229fa3f8a4dc76007f982f9ba8a5c9a39c175e6e8
7
- data.tar.gz: 98ba158b5ccce3fd5b49f6e1ca1eb0f9a3958dbaf0f0d1bb6bddd944208cea89f29195b5688ed43d2b687653e92e9caad3d60f0c0a8cad00e0cd3a0797d3d0ab
6
+ metadata.gz: 577ba2efc0710072f96a4fb043d5d159e141990cf73ffbd88d26daa315b9ffb5e3d3936933ca9206063c7936a4afe54c9d08d10482fb16e6a9b08027f2252bd6
7
+ data.tar.gz: d2d34c02cb98eb5b7b8f50a9f4c7cdb5eab4bb7f657da04738d268f4137a3287a5a34e520ef0e2ac0deda7d84196c871eb32cfa27c9d26103d4953b7d1d95891
data/CHANGELOG.md CHANGED
@@ -17,6 +17,16 @@ Change Log の形式は [Keep a Changelog](http://keepachangelog.com/) に従い
17
17
 
18
18
  ### Security
19
19
 
20
+ ## [3.0.2] - 2022-11-19
21
+ ### Changed
22
+
23
+ - [#59](https://github.com/yamat47/japanese_address_parser/pull/59) デモンストレーション環境のURLを更新した。([@yamat47](https://github.com/yamat47))
24
+
25
+ ## [3.0.1] - 2022-09-25
26
+ ### Added
27
+
28
+ - [#53](https://github.com/yamat47/japanese_address_parser/pull/53) Steepでの型検査の仕組みを導入した。([@yamat47](https://github.com/yamat47))
29
+
20
30
  ## [3.0.0] - 2022-09-25
21
31
  ### Added
22
32
 
data/Dockerfile CHANGED
@@ -13,3 +13,5 @@ WORKDIR $APP_HOME
13
13
  COPY . $APP_HOME
14
14
 
15
15
  RUN bundle install
16
+
17
+ CMD sh -c "/bin/sh"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- japanese_address_parser (3.0.0)
4
+ japanese_address_parser (3.0.2)
5
5
  schmooze
6
6
 
7
7
  GEM
@@ -17,15 +17,24 @@ GEM
17
17
  diff-lcs (1.5.0)
18
18
  factory_bot (6.2.1)
19
19
  activesupport (>= 5.0.0)
20
+ ffi (1.15.5)
20
21
  i18n (1.12.0)
21
22
  concurrent-ruby (~> 1.0)
22
23
  json (2.6.2)
24
+ language_server-protocol (3.17.0.1)
25
+ listen (3.7.1)
26
+ rb-fsevent (~> 0.10, >= 0.10.3)
27
+ rb-inotify (~> 0.9, >= 0.9.10)
23
28
  minitest (5.16.3)
24
29
  parallel (1.22.1)
25
30
  parser (3.1.2.1)
26
31
  ast (~> 2.4.1)
27
32
  rainbow (3.1.1)
28
33
  rake (13.0.6)
34
+ rb-fsevent (0.11.2)
35
+ rb-inotify (0.10.1)
36
+ ffi (~> 1.0)
37
+ rbs (2.6.0)
29
38
  regexp_parser (2.5.0)
30
39
  rexml (3.2.5)
31
40
  rspec (3.11.0)
@@ -59,6 +68,19 @@ GEM
59
68
  rubocop (~> 1.33)
60
69
  ruby-progressbar (1.11.0)
61
70
  schmooze (0.2.0)
71
+ steep (1.1.1)
72
+ activesupport (>= 5.1)
73
+ language_server-protocol (>= 3.15, < 4.0)
74
+ listen (~> 3.0)
75
+ parallel (>= 1.0.0)
76
+ parser (>= 3.1)
77
+ rainbow (>= 2.2.2, < 4.0)
78
+ rbs (>= 2.3.2)
79
+ terminal-table (>= 2, < 4)
80
+ terminal-table (3.0.2)
81
+ unicode-display_width (>= 1.1.1, < 3)
82
+ typeprof (0.21.3)
83
+ rbs (>= 1.8.1)
62
84
  tzinfo (2.0.5)
63
85
  concurrent-ruby (~> 1.0)
64
86
  unicode-display_width (2.3.0)
@@ -66,6 +88,7 @@ GEM
66
88
  PLATFORMS
67
89
  aarch64-linux-musl
68
90
  arm64-darwin-21
91
+ arm64-darwin-22
69
92
  x86_64-darwin-21
70
93
  x86_64-linux
71
94
 
@@ -78,6 +101,8 @@ DEPENDENCIES
78
101
  rubocop
79
102
  rubocop-rake
80
103
  rubocop-rspec
104
+ steep
105
+ typeprof
81
106
 
82
107
  BUNDLED WITH
83
108
  2.3.3
data/README.md CHANGED
@@ -6,7 +6,7 @@ JapaneseAddressParser は日本の住所をパースすることができる Rub
6
6
  住所のパースに使っているのは [geolonia/normalize-japanese-addresses](https://github.com/geolonia/normalize-japanese-addresses) です。
7
7
  npm のライブラリを Ruby のランタイムから呼び出しているため、Node が実行できる環境でしか動作しません。
8
8
 
9
- こちらのページで機能を試すことができます:[デモンストレーション | JapaneseAddressParser](https://japanese-address-parser-demo.herokuapp.com/)
9
+ こちらのページで機能を試すことができます:[デモンストレーション | JapaneseAddressParser](https://japanese-address-parser-demo.fly.dev/)
10
10
 
11
11
  ## インストール
12
12
 
data/Steepfile ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ target :lib do
4
+ signature 'sig'
5
+
6
+ check 'lib'
7
+ ignore 'lib/japanese_address_parser/csv_parser.rb'
8
+
9
+ configure_code_diagnostics(::Steep::Diagnostic::Ruby.strict)
10
+ end
11
+
12
+ target :test do
13
+ signature 'sig'
14
+
15
+ check 'spec'
16
+
17
+ configure_code_diagnostics(::Steep::Diagnostic::Ruby.strict)
18
+ end
data/docker-compose.yml CHANGED
@@ -2,5 +2,6 @@ version: "3"
2
2
  services:
3
3
  gemsrc:
4
4
  build: .
5
+ tty: true
5
6
  volumes:
6
7
  - .:/gemsrc
@@ -38,5 +38,7 @@ require_relative 'lib/japanese_address_parser/version'
38
38
  spec.add_development_dependency('rubocop')
39
39
  spec.add_development_dependency('rubocop-rake')
40
40
  spec.add_development_dependency('rubocop-rspec')
41
+ spec.add_development_dependency('steep')
42
+ spec.add_development_dependency('typeprof')
41
43
  spec.metadata['rubygems_mfa_required'] = 'true'
42
44
  end
@@ -5,10 +5,12 @@ require 'schmooze'
5
5
  module JapaneseAddressParser
6
6
  module AddressNormalizer
7
7
  class NormalizeJapaneseAddressesSchmoozer < ::Schmooze::Base
8
- JS_PACKAGE_PATH = ::File.expand_path('../../../js', __dir__)
8
+ current_dir = __dir__ || ''
9
+
10
+ JS_PACKAGE_PATH = ::File.expand_path('../../../js', current_dir)
9
11
  public_constant :JS_PACKAGE_PATH
10
12
 
11
- JAPANESE_API_PATH = "file://#{::File.expand_path('../data/geolonia-japanese-addresses/api/ja', __dir__)}"
13
+ JAPANESE_API_PATH = "file://#{::File.expand_path('../data/geolonia-japanese-addresses/api/ja', current_dir)}"
12
14
  public_constant :JAPANESE_API_PATH
13
15
 
14
16
  dependencies normalize_japanese_addresses: '@geolonia/normalize-japanese-addresses'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JapaneseAddressParser
4
- VERSION = '3.0.0'
4
+ VERSION = '3.0.2'
5
5
  public_constant :VERSION
6
6
  end
@@ -1,4 +1,85 @@
1
+ # TypeProf 0.21.3
2
+
3
+ # Classes
1
4
  module JapaneseAddressParser
2
5
  VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
6
+
7
+ def self.call: (String full_address) -> Models::Address?
8
+ def self.call!: (String full_address) -> Models::Address
9
+ def self._call: (String full_address) -> Models::Address
10
+
11
+ module AddressNormalizer
12
+ def self.call: (String full_address) -> String
13
+
14
+ class NormalizeJapaneseAddressesSchmoozer < Schmooze::Base
15
+ JS_PACKAGE_PATH: String
16
+ JAPANESE_API_PATH: String
17
+
18
+ def self.call: (String full_address) -> String
19
+ end
20
+ end
21
+
22
+ module AddressParser
23
+ def self.call: (String full_address) -> Models::Address
24
+ end
25
+
26
+ module Models
27
+ class Address
28
+ def initialize: (full_address: String, prefecture: Models::Prefecture?, city: Models::City?, town: Models::Town?) -> void
29
+ def furigana: -> String
30
+ attr_reader full_address: String
31
+ attr_reader prefecture: Models::Prefecture?
32
+ attr_reader city: Models::City?
33
+ attr_reader town: Models::Town?
34
+ end
35
+
36
+ class Town
37
+ def initialize: (name: String, name_kana: String, name_romaji: String, nickname: String, latitude: String, longitude: String) -> void
38
+ def attributes: -> {name: String, name_kana: String, name_romaji: String, nickname: String, latitude: String, longitude: String}
39
+ attr_reader name: String
40
+ attr_reader name_kana: String
41
+ attr_reader name_romaji: String
42
+ attr_reader nickname: String
43
+ attr_reader latitude: String
44
+ attr_reader longitude: String
45
+ end
46
+
47
+ class City
48
+ def initialize: (code: String, prefecture_code: String, name: String, name_kana: String, name_romaji: String) -> void
49
+ def formatted_code: -> String
50
+ def attributes: -> {code: String, prefecture_code: String, name: String, name_kana: String, name_romaji: String}
51
+ def prefecture: -> Models::Prefecture?
52
+ def towns: -> Array[Models::Town]
53
+ attr_reader code: String
54
+ attr_reader prefecture_code: String
55
+ attr_reader name: String
56
+ attr_reader name_kana: String
57
+ attr_reader name_romaji: String
58
+ end
59
+
60
+ class Prefecture
61
+ def self.all: -> Array[Models::Prefecture]
62
+ def initialize: (code: String, name: String, name_kana: String, name_romaji: String) -> void
63
+ def attributes: -> {code: String, name: String, name_kana: String, name_romaji: String}
64
+ def cities: -> Array[Models::City]
65
+ attr_reader code: String
66
+ attr_reader name: String
67
+ attr_reader name_kana: String
68
+ attr_reader name_romaji: String
69
+ end
70
+ end
71
+
72
+ module CsvParser
73
+ HEADER_MAP: Hash[String, Symbol]
74
+
75
+ def self.call: -> Hash[untyped, untyped]
76
+ def self._find_or_build_prefecture: (Array[untyped] prefectures, untyped row) -> Models::Prefecture
77
+ def self._find_or_build_city: (Array[untyped] cities, Models::Prefecture current_prefecture, untyped row) -> Models::City
78
+ def self._find_town: (Array[untyped] towns, untyped row) -> nil
79
+ def self._build_town: (untyped row) -> Models::Town
80
+ def self._write_csv: (Hash[untyped, untyped] prefectures) -> Hash[untyped, untyped]
81
+ def self._write_prefectures_csv: (Array[untyped] prefectures) -> Array[untyped]
82
+ def self._write_cities_csv: (bot prefecture, untyped cities) -> untyped
83
+ def self._write_towns_csv: (untyped prefecture, untyped city, untyped towns) -> untyped
84
+ end
4
85
  end
@@ -0,0 +1,25 @@
1
+ module Schmooze
2
+ class Base
3
+ def self.dependencies: (untyped deps) -> untyped
4
+
5
+ def self.finalize: (untyped stdin, untyped stdout, untyped stderr, untyped process_thread) -> untyped
6
+
7
+ def self.method: (untyped name, untyped code) -> untyped
8
+
9
+ public
10
+
11
+ def pid: () -> untyped
12
+
13
+ private
14
+
15
+ def call_js_method: (untyped method, untyped args) -> untyped
16
+
17
+ def ensure_packages_are_initiated: (untyped stdin, untyped stdout, untyped stderr, untyped process_thread) -> untyped
18
+
19
+ def ensure_process_is_spawned: () -> untyped
20
+
21
+ def initialize: (untyped root, ?untyped env) -> void
22
+
23
+ def spawn_process: () -> untyped
24
+ end
25
+ end
data/typeprof.rbs ADDED
@@ -0,0 +1 @@
1
+ sig/japanese_address_parser.rbs
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: japanese_address_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamaguchi Takuya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-25 00:00:00.000000000 Z
11
+ date: 2022-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: schmooze
@@ -122,6 +122,34 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: steep
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: typeprof
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
125
153
  description: JapaneseAddressParser is a Ruby gem that parses Japanese address. To
126
154
  detect the address, it uses geolonia/japanese-addresses (https://github.com/geolonia/japanese-addresses)
127
155
  CSV data.
@@ -142,6 +170,7 @@ files:
142
170
  - LICENSE.txt
143
171
  - README.md
144
172
  - Rakefile
173
+ - Steepfile
145
174
  - bin/console
146
175
  - bin/setup
147
176
  - docker-compose.yml
@@ -4103,6 +4132,8 @@ files:
4103
4132
  - lib/japanese_address_parser/models/town.rb
4104
4133
  - lib/japanese_address_parser/version.rb
4105
4134
  - sig/japanese_address_parser.rbs
4135
+ - sig/schmooze_base.rbs
4136
+ - typeprof.rbs
4106
4137
  homepage: https://github.com/yamat47/japanese_address_parser
4107
4138
  licenses:
4108
4139
  - MIT
@@ -4126,7 +4157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
4126
4157
  - !ruby/object:Gem::Version
4127
4158
  version: '0'
4128
4159
  requirements: []
4129
- rubygems_version: 3.3.3
4160
+ rubygems_version: 3.4.0.dev
4130
4161
  signing_key:
4131
4162
  specification_version: 4
4132
4163
  summary: Japanese address parser written in Ruby.