thailand 0.0.1.alpha

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0a3edab99a8553824086ec11a6bda23ecf0f1512
4
+ data.tar.gz: 1614d437228bc21302425d0c74b7b48c28c0e212
5
+ SHA512:
6
+ metadata.gz: 894560f11aa3b73c0c277417b911d9814cf87672e12350c8e6b4bf5039e66f37e32373223a0f0069247946acfb5950aea095483ff6e20d80306d12e21f6085e0
7
+ data.tar.gz: e6be30b05b2e11b3c6966f9d4f79f5ba9aba261515c6ebf32c1da593da7bb907a667881739c36f55de844a81a517a9d1ec7ff33f41f53ce5d8d3c2edeffc86b5
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Chainarin Thanichaiyawat and Phuwanart Larpmark
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # Thailand
2
+
3
+ Provinces, districts and subdistricts of Thailand
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'thailand'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install thailand
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ require 'thailand'
25
+ include Thailand
26
+
27
+ thailand = Country.instance
28
+ => <#Thailand::Country>
29
+ thailand.name
30
+ => "Thailand"
31
+ thailand.official_name
32
+ => "Kingdom of Thailand"
33
+ thailand.subregions.size
34
+ => 77
35
+
36
+ bangkok = Province.named 'Bangkok'
37
+ => <#Thailand::Province name="Bangkok">
38
+ bangkok.subregions?
39
+ => true
40
+
41
+ district = District.code '1001'
42
+ => <#Thailand::District name="Phra Nakhon">
43
+ district.name
44
+ => "Phra Nakhon"
45
+ district.subregions?
46
+ => true
47
+
48
+ subdistrict = district.subregions.first
49
+ => <#Thailand::Region name="Phra Borom Maha Ratchawang">
50
+ subdistrict.name
51
+ => "Phra Borom Maha Ratchawang"
52
+ ```
53
+
54
+ ## Contributing
55
+
56
+ 1. Fork it ( https://github.com/kiterminal/thailand/fork )
57
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
58
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
59
+ 4. Push to the branch (`git push origin my-new-feature`)
60
+ 5. Create a new Pull Request
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'thailand'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ module Thailand
2
+ VERSION = '0.0.1.alpha'
3
+ end
data/lib/thailand.rb ADDED
@@ -0,0 +1,35 @@
1
+ require 'yaml'
2
+ require 'pathname'
3
+
4
+ lib_path = File.expand_path('../../lib', __FILE__)
5
+ $LOAD_PATH.unshift(lib_path)
6
+
7
+ require 'thailand/province'
8
+ require 'thailand/district'
9
+ require 'thailand/i18n'
10
+ require 'thailand/version'
11
+
12
+ module Thailand
13
+ class << self
14
+ attr_accessor :data_paths, :i18n_backend, :root_path
15
+
16
+ def clear_data_paths
17
+ Country.instance.reset!
18
+ @data_paths = []
19
+ end
20
+
21
+ def reset_data_paths
22
+ clear_data_paths
23
+ @data_paths << Pathname.new(@root_path + 'data')
24
+ end
25
+
26
+ def reset_i18n_backend
27
+ base_locale_path = @root_path + 'locale'
28
+ @i18n_backend = Thailand::I18n::Simple.new(base_locale_path)
29
+ end
30
+ end
31
+
32
+ @root_path = Pathname.new(__FILE__) + '../..'
33
+ reset_data_paths
34
+ reset_i18n_backend
35
+ end
data/thailand.gemspec ADDED
@@ -0,0 +1,43 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'thailand/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'thailand'
8
+ spec.version = Thailand::VERSION
9
+ spec.platform = Gem::Platform::RUBY
10
+ spec.required_ruby_version = '>= 2.0'
11
+ spec.authors = ['Chainarin Thanichaiyawat', 'Phuwanart Larpmark']
12
+ spec.email = ['kiterminal@gmail.com', 'neokain@gmail.com']
13
+ spec.summary = 'Provinces, districts and subdistricts of Thailand'
14
+ spec.description = 'Provinces, districts and subdistricts of Thailand'
15
+ spec.homepage = 'https://github.com/kiterminal/thailand'
16
+ spec.license = 'MIT'
17
+ spec.metadata = {}
18
+
19
+ spec.files = `git ls-files`.split($RS).reject do |file|
20
+ file =~ %r{^(?:
21
+ |spec/.*
22
+ |spec_data/.*
23
+ |Gemfile
24
+ |Rakefile
25
+ |\.rspec
26
+ |\.gitignore
27
+ |\.rubocop.yml
28
+ |\.rubocop_todo.yml
29
+ |\.travis.yml
30
+ |.*\.eps
31
+ )$}x
32
+ end
33
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
34
+ spec.test_files = []
35
+ spec.require_paths = ['lib']
36
+
37
+ spec.add_dependency 'activesupport', '~> 4.0'
38
+ spec.add_development_dependency 'bundler', '~> 1.9'
39
+ spec.add_development_dependency 'rake', '~> 10.0'
40
+ spec.add_development_dependency 'rspec', '~> 3.2'
41
+ spec.add_development_dependency 'simplecov', '~> 0.10'
42
+ spec.add_development_dependency 'coveralls', '~> 0.8'
43
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thailand
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha
5
+ platform: ruby
6
+ authors:
7
+ - Chainarin Thanichaiyawat
8
+ - Phuwanart Larpmark
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-05-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '4.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '4.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.9'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.9'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '10.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.2'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.2'
70
+ - !ruby/object:Gem::Dependency
71
+ name: simplecov
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.10'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '0.10'
84
+ - !ruby/object:Gem::Dependency
85
+ name: coveralls
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '0.8'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '0.8'
98
+ description: Provinces, districts and subdistricts of Thailand
99
+ email:
100
+ - kiterminal@gmail.com
101
+ - neokain@gmail.com
102
+ executables:
103
+ - console
104
+ - setup
105
+ extensions: []
106
+ extra_rdoc_files: []
107
+ files:
108
+ - CODE_OF_CONDUCT.md
109
+ - LICENSE.txt
110
+ - README.md
111
+ - bin/console
112
+ - bin/setup
113
+ - lib/thailand.rb
114
+ - lib/thailand/version.rb
115
+ - thailand.gemspec
116
+ homepage: https://github.com/kiterminal/thailand
117
+ licenses:
118
+ - MIT
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '2.0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">"
132
+ - !ruby/object:Gem::Version
133
+ version: 1.3.1
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.4.7
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Provinces, districts and subdistricts of Thailand
140
+ test_files: []