GB2260 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +20 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/GB2260.gemspec +33 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/data/GB2260-2002.txt +3510 -0
- data/data/GB2260-2003.txt +3522 -0
- data/data/GB2260-200306.txt +3514 -0
- data/data/GB2260-2004.txt +3523 -0
- data/data/GB2260-200403.txt +3523 -0
- data/data/GB2260-200409.txt +3523 -0
- data/data/GB2260-2005.txt +3523 -0
- data/data/GB2260-200506.txt +3523 -0
- data/data/GB2260-2006.txt +3524 -0
- data/data/GB2260-2007.txt +3524 -0
- data/data/GB2260-2008.txt +3525 -0
- data/data/GB2260-2009.txt +3520 -0
- data/data/GB2260-2010.txt +3518 -0
- data/data/GB2260-2011.txt +3514 -0
- data/data/GB2260-2012.txt +3510 -0
- data/data/GB2260-2013.txt +3515 -0
- data/data/GB2260-2014.txt +3512 -0
- data/lib/GB2260/constants.rb +5 -0
- data/lib/GB2260/data.rb +25 -0
- data/lib/GB2260/division.rb +47 -0
- data/lib/GB2260/version.rb +3 -0
- data/lib/GB2260.rb +35 -0
- metadata +122 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e1f1e39c794df897086e9b57ee7bf6af4a33187a
|
4
|
+
data.tar.gz: 03af9401b3966081100d909294ed954db97458ca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 88ab9591bd0e2bde1ec8a1a3e7fe5a65a5294be51489941bfd6ea6a63849ee8f29009603965ddea119636fd547ed92ab712b1956e90032812739455ff1da0376
|
7
|
+
data.tar.gz: 045dce066250477d0dd069107cf8a5b657865510c045c8acd7825b34f2a8f04c92c233fe43cc05889ee7e929bfa4e60d9d9be492118c49a1352668bfdf5de569
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# GB2260.rb Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
GB2260.rb is in a pre-1.0 state. This means that its APIs and behavior are subject to breaking changes without deprecation notices. Until 1.0, version numbers will follow a [Semver][]-ish `0.y.z` format, where `y` is incremented when new features or breaking changes are introduced, and `z` is incremented for lesser changes or bug fixes.
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
* Your contribution here!
|
10
|
+
|
11
|
+
## 0.1.1 (2015-09-12)
|
12
|
+
|
13
|
+
* Fix description on rubygems
|
14
|
+
|
15
|
+
## 0.1.0 (2015-09-12)
|
16
|
+
|
17
|
+
* Initial release
|
18
|
+
|
19
|
+
[Semver]: http://semver.org
|
20
|
+
[Unreleased]: https://github.com/wolflee/GB2260.rb/compare/v0.1.1...HEAD
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -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, ethnicity, 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/GB2260.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'GB2260/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "GB2260"
|
8
|
+
spec.version = GB2260::VERSION
|
9
|
+
spec.authors = ["WolfLee"]
|
10
|
+
spec.email = ["liyuan0228@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{The Ruby implementation for looking up the Chinese administrative divisions.}
|
13
|
+
spec.homepage = "https://github.com/wolflee/GB2260.rb"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.files << Dir["data/*.txt"]
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec"
|
33
|
+
end
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 WolfLee
|
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,40 @@
|
|
1
|
+
# GB2260
|
2
|
+
|
3
|
+
The Ruby implementation for looking up the Chinese administrative divisions.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'GB2260'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install GB2260
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
The way to look up a administrative division by its GB2260 code is the basic interface
|
24
|
+
`gb2260.get(code)`:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gb2260 = GB2260.new
|
28
|
+
|
29
|
+
division = gb2260.get(360426)
|
30
|
+
puts division # => <GB2260-2014 江西省/九江市/德安县>
|
31
|
+
```
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/wolflee/GB2260.rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
40
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "GB2260"
|
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
|