japanese_address_parser 3.0.0 → 3.0.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: 72363aa74cf45e200716ce789f6755ea43b23b556d913a76cd4479e88c44e571
4
- data.tar.gz: 844e5565b51f6cb3d630b244d77c6197cbbc35e6f57015d807ef546173e03f59
3
+ metadata.gz: 0a042febb9a10f78adeadbd23f6e99a97c69817546479ecbd2dc1cd1fe6f5f50
4
+ data.tar.gz: ed7d82baf90223493a3cb0e33b21afb2a61779cd57718e18f63358ddc963d66f
5
5
  SHA512:
6
- metadata.gz: 780a695538d70fdded3cc8a2be167241f006fa4719658cb7d556d52911be7a91addb6fdea8a7989fcccd945229fa3f8a4dc76007f982f9ba8a5c9a39c175e6e8
7
- data.tar.gz: 98ba158b5ccce3fd5b49f6e1ca1eb0f9a3958dbaf0f0d1bb6bddd944208cea89f29195b5688ed43d2b687653e92e9caad3d60f0c0a8cad00e0cd3a0797d3d0ab
6
+ metadata.gz: fbfe12bdc50a1eaacba31ad237a6034a3d1db4961d2f50b061ab862961753d4a62dc9515cc0d96373d1f432599906a49617687b5ed3b1f89ebf032c6110a0709
7
+ data.tar.gz: 00f949e850de4bd327af851ed3ff4d046423a73473b2a847f5b316fc91cb0dccc4ae06ebd36c7567b75bef8f690a8e48a13ba1c0464ca1ab4b655e874ec558c3
data/CHANGELOG.md CHANGED
@@ -17,6 +17,11 @@ Change Log の形式は [Keep a Changelog](http://keepachangelog.com/) に従い
17
17
 
18
18
  ### Security
19
19
 
20
+ ## [3.0.1] - 2022-09-25
21
+ ### Added
22
+
23
+ - [#53](https://github.com/yamat47/japanese_address_parser/pull/53) Steepでの型検査の仕組みを導入した。([@yamat47](https://github.com/yamat47))
24
+
20
25
  ## [3.0.0] - 2022-09-25
21
26
  ### Added
22
27
 
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.1)
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)
@@ -78,6 +100,8 @@ DEPENDENCIES
78
100
  rubocop
79
101
  rubocop-rake
80
102
  rubocop-rspec
103
+ steep
104
+ typeprof
81
105
 
82
106
  BUNDLED WITH
83
107
  2.3.3
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.1'
5
5
  public_constant :VERSION
6
6
  end
@@ -1,4 +1,81 @@
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 Models
23
+ class Address
24
+ def initialize: (full_address: String, prefecture: String, city: String, town: String) -> void
25
+ def furigana: -> String
26
+ attr_reader full_address: String
27
+ attr_reader prefecture: String
28
+ attr_reader city: String
29
+ attr_reader town: String
30
+ end
31
+
32
+ class Town
33
+ def initialize: (name: String, name_kana: String, name_romaji: String, nickname: String, latitude: String, longitude: String) -> void
34
+ def attributes: -> {name: String, name_kana: String, name_romaji: String, nickname: String, latitude: String, longitude: String}
35
+ attr_reader name: String
36
+ attr_reader name_kana: String
37
+ attr_reader name_romaji: String
38
+ attr_reader nickname: String
39
+ attr_reader latitude: String
40
+ attr_reader longitude: String
41
+ end
42
+
43
+ class City
44
+ def initialize: (code: String, prefecture_code: String, name: String, name_kana: String, name_romaji: String) -> void
45
+ def formatted_code: -> String
46
+ def attributes: -> {code: String, prefecture_code: String, name: String, name_kana: String, name_romaji: String}
47
+ def prefecture: -> Models::Prefecture?
48
+ def towns: -> Array[Models::Town]
49
+ attr_reader code: String
50
+ attr_reader prefecture_code: String
51
+ attr_reader name: String
52
+ attr_reader name_kana: String
53
+ attr_reader name_romaji: String
54
+ end
55
+
56
+ class Prefecture
57
+ def self.all: -> Array[Models::Prefecture]
58
+ def initialize: (code: String, name: String, name_kana: String, name_romaji: String) -> void
59
+ def attributes: -> {code: String, name: String, name_kana: String, name_romaji: String}
60
+ def cities: -> Array[Models::City]
61
+ attr_reader code: String
62
+ attr_reader name: String
63
+ attr_reader name_kana: String
64
+ attr_reader name_romaji: String
65
+ end
66
+ end
67
+
68
+ module CsvParser
69
+ HEADER_MAP: Hash[String, Symbol]
70
+
71
+ def self.call: -> Hash[untyped, untyped]
72
+ def self._find_or_build_prefecture: (Array[untyped] prefectures, untyped row) -> Models::Prefecture
73
+ def self._find_or_build_city: (Array[untyped] cities, Models::Prefecture current_prefecture, untyped row) -> Models::City
74
+ def self._find_town: (Array[untyped] towns, untyped row) -> nil
75
+ def self._build_town: (untyped row) -> Models::Town
76
+ def self._write_csv: (Hash[untyped, untyped] prefectures) -> Hash[untyped, untyped]
77
+ def self._write_prefectures_csv: (Array[untyped] prefectures) -> Array[untyped]
78
+ def self._write_cities_csv: (bot prefecture, untyped cities) -> untyped
79
+ def self._write_towns_csv: (untyped prefecture, untyped city, untyped towns) -> untyped
80
+ end
4
81
  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
metadata CHANGED
@@ -1,7 +1,7 @@
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamaguchi Takuya
@@ -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,7 @@ 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
4106
4136
  homepage: https://github.com/yamat47/japanese_address_parser
4107
4137
  licenses:
4108
4138
  - MIT