luca-jp 0.14.1 → 0.14.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: 605b45fb833509ab94115fefbcd0d94db75f5a232c5391ca6b0f3ba06b62871e
4
- data.tar.gz: 7270ff0d48471dc3a65653f5209f5d00fd0f035c9bdc65e38f3bbf2c4d33f1c0
3
+ metadata.gz: 51503b8d2c4e5ff7ec98bead91c34a6972d73a54c145249252f42bbdc9f4bcfe
4
+ data.tar.gz: 61741745b41a9ebea245c6c3dbde8dd27d9b5d5eaa74b1836d7cb449088453ab
5
5
  SHA512:
6
- metadata.gz: 7bba7eaa908d2e124b7ff1e7f438486106b173001b1e646d5ded0445641585dca28c41697e3fc2e3b1f93c29363d30e81574609e0e46a6157ff4c6ff397c582f
7
- data.tar.gz: d4ca22c3cb75086398b6ec40337f44bc4a0da0bb83f41a837336d31d0cc857aa1d476f05aeef2492c4cc5c724dc8ee1cc3f41d197442639a48d5eda99cea0641
6
+ metadata.gz: 78168441bdb7700c6359e8e80ee492baa32516ec975b01c67515c318e1c588a478bfac2418f9d78170effd4b14545234645965fe258790c9da12e076232210cc
7
+ data.tar.gz: 8077bf6ea387c86108e5ef44f66e405853bc7047037aea1feded14f5cc83ef4c292caab495eb2cc811d5539ac4901f949404c37473ac698a0408a03da3a322de
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Luca
4
4
  module Jp
5
- VERSION = '0.14.1'
5
+ VERSION = '0.14.2'
6
6
  end
7
7
  end
@@ -1,22 +1,26 @@
1
1
  require 'bigdecimal'
2
2
  require 'date'
3
3
  require 'json'
4
+ require 'luca_record'
4
5
  require 'pathname'
5
6
 
6
- class InsuranceJP
7
+ class InsuranceJP < LucaRecord::Base
7
8
  attr_reader :table
9
+ @record_type = 'json'
10
+ @dirname = 'dict'
8
11
 
9
12
  # load config
10
13
  def initialize(dir_path, area=nil, date=nil)
11
- @pjdir = Pathname(dir_path) + 'dict'
14
+ @pjdir = Pathname(dir_path)
12
15
  @area = area
13
16
  @date = date
14
- @table = load_table
17
+ filename = select_active_filename
18
+ @table = self.class.load_table(@pjdir, filename)
15
19
  end
16
20
 
17
- def load_table
18
- file_name = @pjdir + select_active_filename
19
- JSON.parse(File.read(file_name.to_s))
21
+ def self.load_table(pjdir, filename)
22
+ file_path = pjdir / @dirname / filename
23
+ load_data(File.open(file_path))
20
24
  end
21
25
 
22
26
  def health_insurance_salary(rank)
@@ -61,7 +65,7 @@ class InsuranceJP
61
65
 
62
66
  # TODO: Limit only to pension tables.
63
67
  def open_tables
64
- Dir.chdir(@pjdir.to_s) do
68
+ Dir.chdir((@pjdir / 'dict').to_s) do
65
69
  Dir.glob("*.json").each do |file_name|
66
70
  File.open(file_name, 'r') {|f| yield(f, file_name)}
67
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luca-jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.1.26
41
+ - !ruby/object:Gem::Dependency
42
+ name: lucarecord
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.5.5
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.5.5
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: jp-national-tax
43
57
  requirement: !ruby/object:Gem::Requirement