cities-in-turkey 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ module CitiesInTurkey
2
+ class District
3
+ def initialize(name, quarters)
4
+ @name = name
5
+ @quarters = quarters
6
+ end
7
+
8
+ def quarters
9
+ @quarters.map { |quarter| Quarter.new(quarter['name']) }.to_a
10
+ end
11
+
12
+ def name
13
+ @name
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ module CitiesInTurkey
2
+ class Quarter
3
+ def initialize(name)
4
+ @name = name
5
+ end
6
+
7
+ def name
8
+ @name
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ module CitiesInTurkey
2
+ class Town
3
+ def initialize(name, districts)
4
+ @name = name
5
+ @districts = districts
6
+ end
7
+
8
+ def districts
9
+ @districts.map { |district| District.new(district['name'], district['quarters']) }.to_a
10
+ end
11
+
12
+ def name
13
+ @name
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module CitiesInTurkey
2
+ VERSION = "0.2.0"
3
+ end
@@ -0,0 +1,24 @@
1
+ require "cities_in_turkey/version"
2
+ require "cities_in_turkey/city"
3
+ require "cities_in_turkey/town"
4
+ require "cities_in_turkey/district"
5
+ require "cities_in_turkey/quarter"
6
+
7
+ require "yaml"
8
+
9
+ module CitiesInTurkey
10
+ autoload :City, "cities_in_turkey/city"
11
+ autoload :Town, "cities_in_turkey/town"
12
+ autoload :District, "cities_in_turkey/district"
13
+ autoload :Quarter, "cities_in_turkey/quarter"
14
+
15
+ class Error < StandardError; end
16
+
17
+ class << self
18
+ def cities
19
+ @cities ||= YAML.load_file(File.join(File.dirname(__FILE__), "cities_in_turkey/data/cities.yml")).map do |city|
20
+ City.new(city['name'], city['alpha_2_code'], city['towns'])
21
+ end
22
+ end
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cities-in-turkey
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - nejdetkadir
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-01-31 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Cities, towns, districts and quarters in Turkey
14
+ email:
15
+ - nejdetkadir.550@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - CODE_OF_CONDUCT.md
22
+ - Gemfile
23
+ - Gemfile.lock
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - bin/console
28
+ - bin/setup
29
+ - cities-in-turkey.gemspec
30
+ - lib/cities_in_turkey.rb
31
+ - lib/cities_in_turkey/city.rb
32
+ - lib/cities_in_turkey/data/cities.yml
33
+ - lib/cities_in_turkey/district.rb
34
+ - lib/cities_in_turkey/quarter.rb
35
+ - lib/cities_in_turkey/town.rb
36
+ - lib/cities_in_turkey/version.rb
37
+ homepage: https://github.com/nejdetkadir/cities-in-turkey
38
+ licenses:
39
+ - MIT
40
+ metadata:
41
+ homepage_uri: https://github.com/nejdetkadir/cities-in-turkey
42
+ source_code_uri: https://github.com/nejdetkadir/cities-in-turkey
43
+ changelog_uri: https://github.com/nejdetkadir/cities-in-turkey/blob/master/CHANGELOG.md
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 2.3.0
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubygems_version: 3.1.4
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: Cities, towns, districts and quarters in Turkey
63
+ test_files: []