japan_municipality 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "japan_municipality/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "japan_municipality"
9
+ spec.version = JapanMunicipality::VERSION
10
+ spec.authors = ["Juanito Fatas"]
11
+ spec.email = ["juanito.fatas@shopify.com"]
12
+
13
+ spec.summary = %q{Gem for Japan Municipality}
14
+ spec.description = spec.summary
15
+ spec.homepage = "https://github.com/Shopify/japan_municipality"
16
+ spec.license = "MIT"
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+
27
+ spec.add_development_dependency "bundler"
28
+ spec.add_development_dependency "rake"
29
+ spec.add_development_dependency "rspec", "~> 3.7"
30
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class JapanMunicipality
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "japan_municipality/version"
4
+ require "csv"
5
+
6
+ class JapanMunicipality
7
+ def self.all
8
+ DATA[2..-1].map do |data|
9
+ new(data)
10
+ end
11
+ end
12
+
13
+ def initialize(data)
14
+ @area_code = data[0]
15
+ @prefecture = data[1]
16
+ @subprefecture = data[2]
17
+ @subprefecture_furigana = data[3]
18
+ @municipality = data[4]
19
+ @municipality_furigana = data[5]
20
+ @merger_dissolution_date = data[6]
21
+ @has_merger_dissolution_infomation = data[7]
22
+ end
23
+
24
+ # https://www.e-stat.go.jp/municipalities/cities/areacode
25
+ DATA = CSV.read("data/municipalities.csv").freeze
26
+ private_constant :DATA
27
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: japan_municipality
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Juanito Fatas
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-10-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.7'
55
+ description: Gem for Japan Municipality
56
+ email:
57
+ - juanito.fatas@shopify.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - CHANGELOG.md
65
+ - CODE_OF_CONDUCT.md
66
+ - CONTRIBUTING.md
67
+ - Gemfile
68
+ - Gemfile.lock
69
+ - LICENSE.md
70
+ - README.md
71
+ - Rakefile
72
+ - bin/hack
73
+ - bin/setup
74
+ - data/municipalities.csv
75
+ - japan_municipality.gemspec
76
+ - lib/japan_municipality.rb
77
+ - lib/japan_municipality/version.rb
78
+ homepage: https://github.com/Shopify/japan_municipality
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.7.7
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: Gem for Japan Municipality
102
+ test_files: []