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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 515a081cc7eaf92f46bb64b376ee447336fa78da
4
- data.tar.gz: bf0ff13ab19e1cca6f4bef009fa0d8d1235f0c33
3
+ metadata.gz: b9a5fb36bbaa1c5dee5bdae53228772c372840fe
4
+ data.tar.gz: b108ca972d1f49fbca87fe0c00c30ec14de48d03
5
5
  SHA512:
6
- metadata.gz: 7125b61fbeb8609ca3bdd494299ed8692544fc916a927572fb3d75cf5c761756236e5d1dd8a51fa4a9d1c05eede715a28839bb5d5f05706addf7e6611375272f
7
- data.tar.gz: c3ad7e6555a5babb56ac9dedf4610356f66f8d7cdf5f2f89a42133b70ecaab6867047257fc5183842e13d377659320b526dcc8fd9bf131f377e145d49215871d
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?&&region.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
+ ```
@@ -1,3 +1,6 @@
1
+ ##
2
+ # Application controller 是模块内所有控制器的基类。
3
+
1
4
  class Unidom::Geo::China::ApplicationController < ActionController::Base
2
5
  protect_from_forgery with: :exception
3
6
  end
@@ -1,2 +1,5 @@
1
+ ##
2
+ # Application job 是模块内所有异步任务的基类。
3
+
1
4
  class Unidom::Geo::China::ApplicationJob < ActiveJob::Base
2
5
  end
@@ -1,3 +1,6 @@
1
+ ##
2
+ # Application mailer 是模块内所有电子邮件发送类的基类。
3
+
1
4
  class Unidom::Geo::China::ApplicationMailer < ActionMailer::Base
2
5
  default from: 'from@example.com'
3
6
  layout 'mailer'
@@ -1,3 +1,6 @@
1
+ ##
2
+ # Application record 是模块内所有模型的抽象基类。
3
+
1
4
  class Unidom::Geo::China::ApplicationRecord < ActiveRecord::Base
2
5
  self.abstract_class = true
3
6
  end
@@ -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'
@@ -13,4 +13,4 @@ class Unidom::Geo::China::Town < Unidom::Geo::China::ApplicationRecord
13
13
 
14
14
  scope :region_is, ->(region) { where region_id: to_id(region) }
15
15
 
16
- end
16
+ end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Geo::China::Town'
@@ -1,7 +1,7 @@
1
1
  module Unidom
2
2
  module Geo
3
3
  module China
4
- VERSION = '0.4.5'.freeze
4
+ VERSION = '0.4.6'.freeze
5
5
  end
6
6
  end
7
7
  end
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.5
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-09 00:00:00.000000000 Z
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.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.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 (统一领域对象模型)是一系列的领域模型引擎。中国地理领域模型引擎包括中国大陆的行政区划及其相关的模型。