indonesia 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Indonesia
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
@@ -0,0 +1,14 @@
1
+ module Indonesia
2
+ def self.villages(district_id = nil)
3
+ @_villages ||= begin
4
+ data = CSV.read('lib/data/villages.csv')
5
+ data.map { |r| { id: r[0].to_i, district_id: r[1].to_i, name: r[2] } }
6
+ end
7
+
8
+ if district_id.nil?
9
+ @_villages
10
+ else
11
+ @_villages.select { |v| v[:district_id] == district_id.to_i }
12
+ end
13
+ end
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: indonesia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimas J. Taniawan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-13 00:00:00.000000000 Z
11
+ date: 2017-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,6 +83,10 @@ files:
83
83
  - bin/console
84
84
  - bin/setup
85
85
  - indonesia.gemspec
86
+ - lib/data/districts.csv
87
+ - lib/data/provinces.csv
88
+ - lib/data/regencies.csv
89
+ - lib/data/villages.csv
86
90
  - lib/generators/indonesia/install_generator.rb
87
91
  - lib/generators/indonesia/templates/migrations/data.rb
88
92
  - lib/generators/indonesia/templates/migrations/district.rb
@@ -96,6 +100,7 @@ files:
96
100
  - lib/indonesia/province.rb
97
101
  - lib/indonesia/regency.rb
98
102
  - lib/indonesia/version.rb
103
+ - lib/indonesia/village.rb
99
104
  homepage: https://github.com/dimasjt/indonesia
100
105
  licenses:
101
106
  - MIT
@@ -116,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
121
  version: '0'
117
122
  requirements: []
118
123
  rubyforge_project:
119
- rubygems_version: 2.5.1
124
+ rubygems_version: 2.6.11
120
125
  signing_key:
121
126
  specification_version: 4
122
127
  summary: Indonesia addresses