tax_jp 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 854b81f9988e6485e08fd1cb4eb106be06105b7c
4
- data.tar.gz: 8e08125e3d8d069d3d40f0bbb770bb17750a4133
3
+ metadata.gz: 650a1d550ed212642954cfc87463138f4ff34275
4
+ data.tar.gz: a4b87be4557e715d1070cd51d6392de237954f8a
5
5
  SHA512:
6
- metadata.gz: 4587da63c0df075c11fc488d95f2d0e53b2a3e7fc0cb3864f85f2911a44f28486376f354635ee6cb6a884e3e10217e0937c7b743b9b5dee8ae23a4fcba935dd2
7
- data.tar.gz: 989f920686927131aff99f789dafce45968d80b3cec4b1ab4a56603a952bb1cb33cbb8e9f982b87e94549ece689ceae995c15bd9386bf9bda89ad0eb2c5b1a1c
6
+ metadata.gz: dae8cc37ae36fc305c658db858bc8aae8d0bb27552d2156b4a0c4eeb378c3bbf8471cf1abb954749141acc65d5db91ae328bae62e17ed88df3d68fa4e5b9a3f0
7
+ data.tar.gz: 48208ad895ed83d4533a3b84eacd08431fe066e6c4855e00e61e25eacf6430652a79831ab0f30eacb637512f8be8893f70e1f4378ce20ad2eeb710d479dc7788
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - 2.1.0
5
+ - 2.0.0
6
+ script:
7
+ - bundle exec rake close
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
2
  require 'closer/tasks'
3
+
4
+ task :test do
5
+ Rake::Task['close'].invoke
6
+ end
@@ -0,0 +1,48 @@
1
+ prefectures:
2
+ 01: '北海道'
3
+ 02: '青森県'
4
+ 03: '岩手県'
5
+ 04: '宮城県'
6
+ 05: '秋田県'
7
+ 06: '山形県'
8
+ 07: '福島県'
9
+ 08: '茨城県'
10
+ 09: '栃木県'
11
+ 10: '群馬県'
12
+ 11: '埼玉県'
13
+ 12: '千葉県'
14
+ 13: '東京都'
15
+ 14: '神奈川県'
16
+ 15: '新潟県'
17
+ 16: '富山県'
18
+ 17: '石川県'
19
+ 18: '福井県'
20
+ 19: '山梨県'
21
+ 20: '長野県'
22
+ 21: '岐阜県'
23
+ 22: '静岡県'
24
+ 23: '愛知県'
25
+ 24: '三重県'
26
+ 25: '滋賀県'
27
+ 26: '京都府'
28
+ 27: '大阪府'
29
+ 28: '兵庫県'
30
+ 29: '奈良県'
31
+ 30: '和歌山県'
32
+ 31: '鳥取県'
33
+ 32: '島根県'
34
+ 33: '岡山県'
35
+ 34: '広島県'
36
+ 35: '山口県'
37
+ 36: '徳島県'
38
+ 37: '香川県'
39
+ 38: '愛媛県'
40
+ 39: '高知県'
41
+ 40: '福岡県'
42
+ 41: '佐賀県'
43
+ 42: '長崎県'
44
+ 43: '熊本県'
45
+ 44: '大分県'
46
+ 45: '宮崎県'
47
+ 46: '鹿児島県'
48
+ 47: '沖縄県'
@@ -0,0 +1,12 @@
1
+ もし /^JISで定義されているコードは以下の通りです。$/ do |ast_table|
2
+ assert rows = ast_table.raw
3
+ assert_equal 47, rows.size
4
+
5
+ rows.each do |row|
6
+ code = row[0]
7
+ name = row[1]
8
+ assert p = TaxJp::Prefecture.find_by_code(code)
9
+ assert_equal name, p.name
10
+ end
11
+ end
12
+
@@ -0,0 +1,53 @@
1
+ # language: ja
2
+
3
+ 機能: 都道府県
4
+
5
+ シナリオ: 都道府県コード
6
+ * JISで定義されているコードは以下の通りです。
7
+ | 01 | 北海道 |
8
+ | 02 | 青森県 |
9
+ | 03 | 岩手県 |
10
+ | 04 | 宮城県 |
11
+ | 05 | 秋田県 |
12
+ | 06 | 山形県 |
13
+ | 07 | 福島県 |
14
+ | 08 | 茨城県 |
15
+ | 09 | 栃木県 |
16
+ | 10 | 群馬県 |
17
+ | 11 | 埼玉県 |
18
+ | 12 | 千葉県 |
19
+ | 13 | 東京都 |
20
+ | 14 | 神奈川県 |
21
+ | 15 | 新潟県 |
22
+ | 16 | 富山県 |
23
+ | 17 | 石川県 |
24
+ | 18 | 福井県 |
25
+ | 19 | 山梨県 |
26
+ | 20 | 長野県 |
27
+ | 21 | 岐阜県 |
28
+ | 22 | 静岡県 |
29
+ | 23 | 愛知県 |
30
+ | 24 | 三重県 |
31
+ | 25 | 滋賀県 |
32
+ | 26 | 京都府 |
33
+ | 27 | 大阪府 |
34
+ | 28 | 兵庫県 |
35
+ | 29 | 奈良県 |
36
+ | 30 | 和歌山県 |
37
+ | 31 | 鳥取県 |
38
+ | 32 | 島根県 |
39
+ | 33 | 岡山県 |
40
+ | 34 | 広島県 |
41
+ | 35 | 山口県 |
42
+ | 36 | 徳島県 |
43
+ | 37 | 香川県 |
44
+ | 38 | 愛媛県 |
45
+ | 39 | 高知県 |
46
+ | 40 | 福岡県 |
47
+ | 41 | 佐賀県 |
48
+ | 42 | 長崎県 |
49
+ | 43 | 熊本県 |
50
+ | 44 | 大分県 |
51
+ | 45 | 宮崎県 |
52
+ | 46 | 鹿児島県 |
53
+ | 47 | 沖縄県 |
@@ -0,0 +1,29 @@
1
+ require 'yaml'
2
+
3
+ module TaxJp
4
+ class Prefecture
5
+ attr_reader :code, :name
6
+
7
+ def initialize(code, name)
8
+ @code = code
9
+ @name = name
10
+ end
11
+
12
+ @@prefectures = {}
13
+ gem_dir = File.dirname(File.dirname(File.dirname(__FILE__)))
14
+ prefectures = YAML.load_file(File.join(gem_dir, 'data', 'prefectures.yml'))['prefectures']
15
+ prefectures.each do |key, value|
16
+ code = "%02d" % key.to_i
17
+ @@prefectures[code] = Prefecture.new(code, value)
18
+ end
19
+
20
+ def self.all
21
+ @@prefectures.values
22
+ end
23
+
24
+ def self.find_by_code(code)
25
+ @@prefectures["%02d" % code.to_i]
26
+ end
27
+
28
+ end
29
+ end
@@ -1,3 +1,3 @@
1
1
  module TaxJp
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
data/lib/tax_jp.rb CHANGED
@@ -6,6 +6,8 @@ if defined?(Rails)
6
6
  require 'tax_jp/rails/railtie'
7
7
  end
8
8
 
9
+ require 'tax_jp/prefecture'
10
+
9
11
  module TaxJp
10
12
  require 'tax_jp/consumption_tax'
11
13
  extend TaxJp::ConsumptionTax
data/tax_jp.gemspec CHANGED
@@ -5,8 +5,8 @@ require 'tax_jp/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "tax_jp"
7
7
  spec.version = TaxJp::VERSION
8
- spec.authors = ["ichy"]
9
- spec.email = ["ichylinux@gmail.com"]
8
+ spec.authors = ['ichylinux', 'hyzhiro']
9
+ spec.email = ['ichylinux@gmail.com', 'hiroyuki@hybitz.co.jp']
10
10
  spec.summary = %q{税金計算ライブラリ}
11
11
  spec.description = %q{税金計算ライブラリ}
12
12
  spec.homepage = 'https://github.com/hybitz/tax_jp'
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tax_jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
- - ichy
7
+ - ichylinux
8
+ - hyzhiro
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
@@ -55,24 +56,30 @@ dependencies:
55
56
  description: "税金計算ライブラリ"
56
57
  email:
57
58
  - ichylinux@gmail.com
59
+ - hiroyuki@hybitz.co.jp
58
60
  executables: []
59
61
  extensions: []
60
62
  extra_rdoc_files: []
61
63
  files:
62
64
  - ".gitignore"
65
+ - ".travis.yml"
63
66
  - Gemfile
64
67
  - LICENSE
65
68
  - README.md
66
69
  - Rakefile
67
70
  - app/assets/javascripts/tax.js
68
71
  - app/assets/javascripts/tax_jp.js
72
+ - data/prefectures.yml
69
73
  - features/.gitignore
70
74
  - features/step_definitions/consumption_tax.rb
75
+ - features/step_definitions/prefectures.rb
71
76
  - features/support/env.rb
72
77
  - features/消費税.feature
78
+ - features/都道府県.feature
73
79
  - lib/tax_jp.rb
74
80
  - lib/tax_jp/const.rb
75
81
  - lib/tax_jp/consumption_tax.rb
82
+ - lib/tax_jp/prefecture.rb
76
83
  - lib/tax_jp/rails/engine.rb
77
84
  - lib/tax_jp/rails/railtie.rb
78
85
  - lib/tax_jp/version.rb
@@ -104,5 +111,7 @@ summary: "税金計算ライブラリ"
104
111
  test_files:
105
112
  - features/.gitignore
106
113
  - features/step_definitions/consumption_tax.rb
114
+ - features/step_definitions/prefectures.rb
107
115
  - features/support/env.rb
108
116
  - features/消費税.feature
117
+ - features/都道府県.feature