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 +4 -4
- data/HISTORY.md +5 -0
- data/data//345/205/203/345/217/267.yml +4 -0
- data/lib/tax_jp/gengou.rb +40 -0
- data/lib/tax_jp/version.rb +1 -1
- data/lib/tax_jp.rb +3 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1ac7069f3f323b2ff8c4e126a52cbba98e52a7b
|
4
|
+
data.tar.gz: b40f5961e171664c65562417a9fb77170aebf1ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 027114258b4fcaa5516534588b067da14234c97ad8885c4e0b1e0a752160196640252db5bf4f9d3e261875a7b7873d0a65709a04b8d6a0ab66ed0b1a98bbfec0
|
7
|
+
data.tar.gz: e644844bc46fc6da22e921065f5080ce38919de30ef2672da5557bb823ec7240c982b1a79744ca03a173d399527225c9df40c6d5cf90bf834f7f451f8813c864
|
data/HISTORY.md
CHANGED
@@ -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
|
data/lib/tax_jp/version.rb
CHANGED
data/lib/tax_jp.rb
CHANGED
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.
|
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-
|
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
|