tax_jp 0.3.1 → 0.3.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
  SHA1:
3
- metadata.gz: 20c4fc811b03ea6e993392e85a7697e024b31488
4
- data.tar.gz: 2d962416d82390e47bb01bb90f1405d4e34cb7b1
3
+ metadata.gz: e1ac7069f3f323b2ff8c4e126a52cbba98e52a7b
4
+ data.tar.gz: b40f5961e171664c65562417a9fb77170aebf1ef
5
5
  SHA512:
6
- metadata.gz: 2f25dd1ddfc27988e198b01963fe73eb34d6ba2cef2d5eb1781e247734ce23142099ff3473b3356f871d65bfde0e64a0a76e4659c54bf9c0e09f1afd91376ffb
7
- data.tar.gz: 6a5d179a84f33c75ecc105a374805286a0c7fec5f1fa889d1cab101791d7b65bb870b441610e46585f7b65142905600bdb2efc0e351f5d97b6f8a9da0bf99a80
6
+ metadata.gz: 027114258b4fcaa5516534588b067da14234c97ad8885c4e0b1e0a752160196640252db5bf4f9d3e261875a7b7873d0a65709a04b8d6a0ab66ed0b1a98bbfec0
7
+ data.tar.gz: e644844bc46fc6da22e921065f5080ce38919de30ef2672da5557bb823ec7240c982b1a79744ca03a173d399527225c9df40c6d5cf90bf834f7f451f8813c864
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ # バージョン 0.3.2
2
+
3
+ ### 追加
4
+ * 元号
5
+
1
6
  # バージョン 0.3.1
2
7
 
3
8
  ### 追加
@@ -0,0 +1,4 @@
1
+ 1868: "明治"
2
+ 1912: "大正"
3
+ 1926: "昭和"
4
+ 1989: "平成"
@@ -0,0 +1,40 @@
1
+ require 'yaml'
2
+
3
+ module TaxJp
4
+ class Gengou
5
+ @@_gengou = TaxJp::Utils.load_yaml('元号.yml')
6
+
7
+ def self.to_seireki(gengou, year_jp)
8
+ target_gengou = nil
9
+ @@_gengou.invert.keys.each do |start_gengou|
10
+ if start_gengou == gengou.to_s
11
+ target_gengou = start_gengou
12
+ break
13
+ end
14
+ end
15
+
16
+ return nil unless target_gengou
17
+
18
+ start_year = @@_gengou.invert[target_gengou].to_i
19
+ return (start_year + year_jp.to_i - 1).to_s
20
+ end
21
+
22
+ def self.to_wareki(year)
23
+ return nil unless year.present?
24
+
25
+ target_year = nil
26
+ @@_gengou.keys.sort.each do |start_year|
27
+ break if start_year.to_i > year.to_i
28
+ target_year = start_year
29
+ end
30
+
31
+ return nil unless target_year
32
+
33
+ gengou = @@_gengou[target_year]
34
+ year_jp = year - target_year + 1
35
+
36
+ return gengou + (year_jp == 1 ? '元' : year_jp.to_s)
37
+ end
38
+
39
+ end
40
+ end
@@ -1,3 +1,3 @@
1
1
  module TaxJp
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
data/lib/tax_jp.rb CHANGED
@@ -11,6 +11,9 @@ require 'tax_jp/utils'
11
11
  require 'tax_jp/prefecture'
12
12
 
13
13
  module TaxJp
14
+ # 元号
15
+ require 'tax_jp/gengou'
16
+
14
17
  # 住所
15
18
  require 'tax_jp/address'
16
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tax_jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichylinux
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-17 00:00:00.000000000 Z
12
+ date: 2016-06-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqlite3
@@ -107,6 +107,7 @@ files:
107
107
  - data/住所.db
108
108
  - data/住所/addresses.csv
109
109
  - data/住所/schema_addresses.sql
110
+ - data/元号.yml
110
111
  - data/消費税.yml
111
112
  - data/減価償却率.db
112
113
  - data/減価償却率/schema_depreciation_rates.sql
@@ -151,6 +152,7 @@ files:
151
152
  - lib/tax_jp/consumption_tax.rb
152
153
  - lib/tax_jp/depreciation_rate.rb
153
154
  - lib/tax_jp/depreciation_rates/db_builder.rb
155
+ - lib/tax_jp/gengou.rb
154
156
  - lib/tax_jp/prefecture.rb
155
157
  - lib/tax_jp/rails/engine.rb
156
158
  - lib/tax_jp/rails/railtie.rb