turkey_regions 0.1.0
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 +7 -0
- data/lib/turkey_regions.rb +22 -0
- metadata +43 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: da214e847032e8aa7351ab796f909dd1de313834f6ebe1f24eff46a77f85ce42
|
|
4
|
+
data.tar.gz: ef9644e474a4f948c5df9fe1be4b31d33b2079a1f569dafbb1473a7fcf07becb
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ad85898103a8f401f45d4739b896bb17027864e221bc0f1ac57e73476b28aeb0d9f79f133b191b309d24a8306cfff3321ac9a9b6021d4bf0902637797be58ecf
|
|
7
|
+
data.tar.gz: df6fc93071050d50184fcfcef637f21f7221f5237bc01e0937a78119e2bb8e57113a8804a55e6688714d07fbf72d8b0bcf165acbef0b2bc3810bc309a4d56e14
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
class TurkeyRegions
|
|
2
|
+
def self.regions
|
|
3
|
+
items = []
|
|
4
|
+
region_source = YAML.load_file(File.join((File.dirname __dir__), 'lib', 'data', 'regions_and_cities.yaml'))
|
|
5
|
+
region_source.each do |region|
|
|
6
|
+
items << { id: region[0], name: region[1]['translations'][I18n.locale.to_s.split('-')[0]] }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
items
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.cities_by_region(region)
|
|
13
|
+
begin
|
|
14
|
+
region_source = YAML.load_file(File.join((File.dirname __dir__), 'lib', 'data', 'regions_and_cities.yaml'))
|
|
15
|
+
founded_region = region_source.select { |r| r == region }
|
|
16
|
+
|
|
17
|
+
founded_region[region]['subdivision_codes'].map(&:to_s)
|
|
18
|
+
rescue
|
|
19
|
+
raise StandardError.new('given region could not be found')
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: turkey_regions
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- ilkay orhanlar
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-12-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: 7 Turkey regions and cities of regions
|
|
14
|
+
email: ilkayorhanlar@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/turkey_regions.rb
|
|
20
|
+
homepage: https://github.com/ilkayorhanlar/turkey_regions
|
|
21
|
+
licenses:
|
|
22
|
+
- MIT
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubygems_version: 3.0.6
|
|
40
|
+
signing_key:
|
|
41
|
+
specification_version: 4
|
|
42
|
+
summary: Turkey regions
|
|
43
|
+
test_files: []
|