jp_local_gov 0.2.1 → 0.3.0

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: 1064004563bbd71eb56c0a781e3463c8c23e0d935266502be61ec6656c64c52d
4
- data.tar.gz: b146e13771053689affcd052749a813663ccd050c00b2cd409aeeb793d8b4b6d
3
+ metadata.gz: 4e26bf255e214fe5c02ed9107514ea8ef6035f30d05fe6d8c81046b207017d6f
4
+ data.tar.gz: 91459fd623a506b3d413822c315c1e8dd9a2c4836f72f8f57610e56ef9bafda3
5
5
  SHA512:
6
- metadata.gz: 539a20cd3cd47024b0f6eafae555bded886a3e6535991896a4bc00c08c79f7cf4440902551f6d4144e57decf5364b5fd278e7e553b1087ddf6d9be21a11f4a01
7
- data.tar.gz: ff280b50246b7226889384844efab5eb9560ca065ad29c8ca00ed4437ae375a9578602e1468a2fc4fbbfbe8ecf4c1c8594770c9567e9c3008cf4b666544b74c7
6
+ metadata.gz: 5b823186ad99d95abbe568abcde106dc6a219325925ebd86e33b68d8a0298493d780189827e62d4d592c1af3ca62f4c30ab1213ea01379f9e6fd976eba622e93
7
+ data.tar.gz: 401a89148433d2061da067688160c25d381544184f2601b948bd0f2bd6f2efdf9346f5404b5c36736408e97cd38c0cdc3c94afcf8e0cc96c8689b054d2d6dc92
@@ -9,12 +9,15 @@ on:
9
9
  jobs:
10
10
  lint:
11
11
  runs-on: ubuntu-latest
12
-
12
+ strategy:
13
+ matrix:
14
+ ruby: [2.7, '3.0', 3.1]
13
15
  steps:
14
16
  - uses: actions/checkout@v2
15
17
  - name: Set up Ruby
16
18
  uses: ruby/setup-ruby@v1
17
19
  with:
20
+ ruby-version: ${{ matrix.ruby }}
18
21
  bundler-cache: true
19
22
 
20
23
  - name: Rubocop
@@ -10,10 +10,14 @@ on:
10
10
  jobs:
11
11
  check:
12
12
  runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ ruby: [2.7, '3.0', 3.1]
13
16
  steps:
14
17
  - uses: actions/checkout@v2
15
18
  - uses: ruby/setup-ruby@v1
16
19
  with:
20
+ ruby-version: ${{ matrix.ruby }}
17
21
  bundler-cache: true
18
22
  - run: bundle exec appraisal install
19
23
  - run: |
@@ -21,10 +25,14 @@ jobs:
21
25
  shell: bash
22
26
  stats:
23
27
  runs-on: ubuntu-latest
28
+ strategy:
29
+ matrix:
30
+ ruby: [2.7, '3.0', 3.1]
24
31
  steps:
25
32
  - uses: actions/checkout@v2
26
33
  - uses: ruby/setup-ruby@v1
27
34
  with:
35
+ ruby-version: ${{ matrix.ruby }}
28
36
  bundler-cache: true
29
37
  - run: bundle exec appraisal install
30
38
  - run: bundle exec rake steep:stats
@@ -7,14 +7,17 @@ on:
7
7
  branches: ["main"]
8
8
 
9
9
  jobs:
10
- lint:
10
+ test:
11
11
  runs-on: ubuntu-latest
12
-
12
+ strategy:
13
+ matrix:
14
+ ruby: [2.7, '3.0', 3.1]
13
15
  steps:
14
16
  - uses: actions/checkout@v2
15
17
  - name: Set up Ruby
16
18
  uses: ruby/setup-ruby@v1
17
19
  with:
20
+ ruby-version: ${{ matrix.ruby }}
18
21
  bundler-cache: true
19
22
  - run: bundle exec appraisal install
20
23
  - run: bundle exec appraisal rspec
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 3.0
2
+ TargetRubyVersion: 2.7
3
3
 
4
4
  Style/StringLiterals:
5
5
  Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [0.3.0](https://github.com/IkumaTadokoro/jp_local_gov/compare/v0.2.1...v0.3.0) (2022-01-28)
2
+
3
+ ### feat
4
+
5
+ * Loosen Ruby version requirement to 2.7.0 ([e3d5f6da](https://github.com/IkumaTadokoro/jp_local_gov/commit/e3d5f6dafcb6665444e81289fcb91ce7d4365a3a))
6
+ * Removing `.ruby-version` file lets other devs to use their preferred version of Ruby ([3b3bd483](https://github.com/IkumaTadokoro/jp_local_gov/commit/3b3bd483c167266338fe07d627d58de3d833b37d))
7
+
1
8
  ## [0.2.1](https://github.com/IkumaTadokoro/jp_local_gov/compare/v0.2.0...v0.2.1) (2022-01-14)
2
9
 
3
10
  ### docs
data/jp_local_gov.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "Convert japan local government code (JIS X 0402 based) into the local government name."
13
13
  spec.homepage = "https://github.com/IkumaTadokoro/jp_local_gov"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = ">= 3.0.0"
15
+ spec.required_ruby_version = ">= 2.7.0"
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
18
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -4,7 +4,7 @@ require_relative "../jp_local_gov"
4
4
 
5
5
  module JpLocalGov
6
6
  module Random
7
- DATA_DIR = "#{File.dirname(__FILE__)}/../../data/json/".freeze
7
+ DATA_DIR = "#{File.dirname(__FILE__)}/../../data/json/"
8
8
  RANDOMIZE_TARGET = %w[code city city_kana prefecture prefecture_code prefecture_kana].freeze
9
9
 
10
10
  module_function
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JpLocalGov
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/jp_local_gov.rb CHANGED
@@ -7,10 +7,10 @@ require_relative "jp_local_gov/random"
7
7
  require "json"
8
8
 
9
9
  module JpLocalGov
10
- DATA_DIR = "#{File.dirname(__FILE__)}/../data/json/".freeze
10
+ DATA_DIR = "#{File.dirname(__FILE__)}/../data/json/"
11
11
  CHECK_DIGITS_INDEX = 5
12
12
  CHECK_BASE = 11
13
- PREFECTURE_RANGE = 1..47
13
+ PREFECTURE_RANGE = (1..47).freeze
14
14
  VALID_CODE_LENGTH = 6
15
15
 
16
16
  module_function
@@ -23,7 +23,7 @@ module JpLocalGov
23
23
  return nil unless valid_code?(local_gov_code)
24
24
 
25
25
  json_file = "#{DATA_DIR}#{local_gov_code[0..1]}.json"
26
- data = JSON.parse(File.open(json_file).read, { symbolize_names: true })
26
+ data = json_data_from(json_file)
27
27
  local_gov_data = data[local_gov_code.to_sym]
28
28
  return nil if local_gov_data.nil?
29
29
 
@@ -35,7 +35,7 @@ module JpLocalGov
35
35
 
36
36
  json_files = prefecture_code_list.map { "#{DATA_DIR}#{_1}.json" }
37
37
  results = json_files.map do |json_file|
38
- data = JSON.parse(File.read(json_file), { symbolize_names: true })
38
+ data = json_data_from(json_file)
39
39
  build_local_gov(data, conditions)
40
40
  end.flatten.compact
41
41
  return nil if results.empty?
@@ -62,7 +62,7 @@ module JpLocalGov
62
62
  def all
63
63
  json_files = prefecture_code_list.map { "#{DATA_DIR}#{_1}.json" }
64
64
  json_files.flat_map do |json_file|
65
- data = JSON.parse(File.read(json_file), { symbolize_names: true })
65
+ data = json_data_from(json_file)
66
66
  data.values.map { |value| JpLocalGov::LocalGov.new(value) }
67
67
  end
68
68
  end
@@ -82,6 +82,10 @@ module JpLocalGov
82
82
  [*PREFECTURE_RANGE].map { format("%02<number>d", number: _1) }
83
83
  end
84
84
 
85
- private_class_method :build_local_gov, :filter, :prefecture_code_list
85
+ def json_data_from(json_file)
86
+ JSON.parse(File.read(json_file), { symbolize_names: true })
87
+ end
88
+
89
+ private_class_method :build_local_gov, :filter, :prefecture_code_list, :json_data_from
86
90
  private_constant :CHECK_DIGITS_INDEX, :CHECK_BASE
87
91
  end
data/sig/jp_local_gov.rbs CHANGED
@@ -24,4 +24,6 @@ module JpLocalGov
24
24
  def self?.filter: (Hash[Symbol, untyped] target, Hash[Symbol, String] conditions) -> bool
25
25
 
26
26
  def prefecture_code_list: () -> Array[String]
27
+
28
+ def self?.json_data_from: (String) -> Hash[Symbol, untyped]
27
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jp_local_gov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ikuma-t
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-14 00:00:00.000000000 Z
11
+ date: 2022-01-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Convert japan local government code (JIS X 0402 based) into the local
14
14
  government name.
@@ -32,7 +32,6 @@ files:
32
32
  - ".gitignore"
33
33
  - ".rspec"
34
34
  - ".rubocop.yml"
35
- - ".ruby-version"
36
35
  - Appraisals
37
36
  - CHANGELOG.md
38
37
  - CODE_OF_CONDUCT.md
@@ -126,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
125
  requirements:
127
126
  - - ">="
128
127
  - !ruby/object:Gem::Version
129
- version: 3.0.0
128
+ version: 2.7.0
130
129
  required_rubygems_version: !ruby/object:Gem::Requirement
131
130
  requirements:
132
131
  - - ">="
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.0.0