unidom-geo-china 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -3
- data/app/controllers/unidom/geo/china/application_controller.rb +3 -0
- data/app/jobs/unidom/geo/china/application_job.rb +3 -0
- data/app/mailers/unidom/geo/china/application_mailer.rb +3 -0
- data/app/models/unidom/geo/china/application_record.rb +3 -0
- data/app/models/unidom/geo/china/region.rb +3 -1
- data/app/models/unidom/geo/china/town.rb +1 -1
- data/lib/unidom/geo/china/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9a5fb36bbaa1c5dee5bdae53228772c372840fe
|
4
|
+
data.tar.gz: b108ca972d1f49fbca87fe0c00c30ec14de48d03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 151aa0ab1ec3077af8892775c29874b9c0d1ad8a7e4572ea91ea4b1cabc9c8e4245f43235d09fa8b95fc9b782e260c184241e1825d1026bd12ccd7bfdb6ac825
|
7
|
+
data.tar.gz: e83d0e5458972c7b7d66f153875467bac9f2ca4e9d9f5978d3433357fe5fdc6278e043d33114c0370fa7bed5b41d93f7740609b20f852f5748e2767996cdfa9a
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Unidom Geo China 中国地理领域模型引擎
|
2
2
|
|
3
|
+
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/unidom-geo-china/frames)
|
3
4
|
[![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
|
5
|
+
|
4
6
|
[![Gem Version](https://badge.fury.io/rb/unidom-geo-china.svg)](https://badge.fury.io/rb/unidom-geo-china)
|
5
7
|
[![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-geo-china.svg)](https://gemnasium.com/github.com/topbitdu/unidom-geo-china)
|
6
8
|
|
@@ -57,7 +59,7 @@ The Region model has a lot of domain knowlegde of the China regions.
|
|
57
59
|
- ```!region.numeric_code_middle_empty?&®ion.numeric_code_suffix_empty?``` indicates whether the ```region``` is a city. 判断行政区划是否是一个地级市、地区、自治州、盟。
|
58
60
|
- ```!region..numeric_code_suffix_empty?``` indicates whether the ```region``` is a county. 判断行政区划是否是一个自治县、县级市、旗、自治旗、市辖区、林区、特区。
|
59
61
|
- ```region.mducg?``` indicates whether the ```region``` is a municipality direct under central government. 判断行政区划是否是一个直辖市。
|
60
|
-
-
|
62
|
+
-
|
61
63
|
```region.under_mducg?``` indicates whether the ```region``` is under any municipality direct under central government. 判断行政区划是否是一个直辖市的下级行政区划。
|
62
64
|
- ```region.under? another_region``` indicates the ```region``` is under the given another_region. 判断行政区划是否是一个给定行政区划的下级(含直接和间接下级)。
|
63
65
|
- ```region.super_regions``` returns a scope for the super regions of the ```region```. 返回找到 ```region``` 直接上级行政区划的查询 scope。
|
@@ -74,10 +76,26 @@ include Unidom::Geo::China::Concerns::AsSuperiorRegion
|
|
74
76
|
|
75
77
|
### As Inferior Region
|
76
78
|
|
77
|
-
The As Inferior Region do the following tasks for the includer automatically:
|
79
|
+
The As Inferior Region do the following tasks for the includer automatically:
|
78
80
|
1. Define the #super_regions method as: ``super_regions``
|
79
81
|
|
80
82
|
### As Superior Region
|
81
83
|
|
82
|
-
The As Superior Region do the following tasks for the includer automatically:
|
84
|
+
The As Superior Region do the following tasks for the includer automatically:
|
83
85
|
1. Define the #sub_regions method as: ``sub_regions``
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
## Disable the Model & Migration
|
90
|
+
|
91
|
+
If you only need the app components other than models, the migrations should be neglected, and the models should not be loaded.
|
92
|
+
```ruby
|
93
|
+
# config/initializers/unidom.rb
|
94
|
+
Unidom::Common.configure do |options|
|
95
|
+
|
96
|
+
options[:neglected_namespaces] = %w{
|
97
|
+
Unidom::Geo::China
|
98
|
+
}
|
99
|
+
|
100
|
+
end
|
101
|
+
```
|
@@ -48,6 +48,8 @@ class Unidom::Geo::China::Region < Unidom::Geo::China::ApplicationRecord
|
|
48
48
|
|
49
49
|
scope :root_level, -> { numeric_code_ending_with '0000' }
|
50
50
|
|
51
|
+
##
|
52
|
+
# 获取行政区划代码的前 2 位数字。
|
51
53
|
def numeric_code_prefix
|
52
54
|
numeric_code[0..1]
|
53
55
|
end
|
@@ -99,4 +101,4 @@ class Unidom::Geo::China::Region < Unidom::Geo::China::ApplicationRecord
|
|
99
101
|
numeric_code_suffix_empty? ? false : region.numeric_code_suffix_empty?
|
100
102
|
end
|
101
103
|
|
102
|
-
end
|
104
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Geo::China::Region'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-geo-china
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-geo
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '1.4'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.4.
|
22
|
+
version: 1.4.5
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '1.4'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.4.
|
32
|
+
version: 1.4.5
|
33
33
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
34
34
|
The China Contact domain model engine includes Mobile Phone Number and its relative
|
35
35
|
models. Unidom (统一领域对象模型)是一系列的领域模型引擎。中国地理领域模型引擎包括中国大陆的行政区划及其相关的模型。
|