unidom-geo 1.4.3 → 1.4.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efcb0688d9ec979b82156870f7f494d4a92d9a20
4
- data.tar.gz: ee8eb640721287c302965c55dc85861ff9c0f63a
3
+ metadata.gz: de985c80fc44a553c419760277bd898648418822
4
+ data.tar.gz: 054d7ae8e6270cd72999fb9437f172124807add3
5
5
  SHA512:
6
- metadata.gz: 858d7bb9325be85b38bd065bbca87595fd50e53296d0c36311af6de0936f1aaee95465fc5b552f713be1af42b8dbb350cd55902871148bc5a90c9b70f9e2cdae
7
- data.tar.gz: f8025d7345f759fd05d9d85ae5e6442af982dba3e16c7a1cfb548509d028acc075502e0198ba53ecd12d04110d3774eccb9e6b5201c38540d1d890d88c351aeb
6
+ metadata.gz: 832ea4737e1ecb94dd8f3d1dbdfe4e17b560a09cd189e0dfa7ec9f3c10a160c38c642656f23fe0bc2c90d0bb2c134498da4615732aaa4890ab0dd0596e1ad656
7
+ data.tar.gz: e2dad2bc6c0c2ba21b31c30356a30a22e6d5cf4b71c1517cce315d59a15ebb5eae0d50b84b3e84987323d5507b7d0fa69e278427717bc19b7012ae1b9abb3a8f
@@ -1,3 +1,6 @@
1
+ ##
2
+ # As Located 是为地标提供的领域逻辑关注点。
3
+
1
4
  module Unidom::Geo::Concerns::AsLocated
2
5
 
3
6
  extend ActiveSupport::Concern
@@ -1,3 +1,6 @@
1
+ ##
2
+ # As Locator 是为定位者或者定位程序提供的领域逻辑关注点。
3
+
1
4
  module Unidom::Geo::Concerns::AsLocator
2
5
 
3
6
  extend ActiveSupport::Concern
@@ -1,3 +1,6 @@
1
+ ##
2
+ # As Region 是为行政区划提供的领域逻辑关注点。
3
+
1
4
  module Unidom::Geo::Concerns::AsRegion
2
5
 
3
6
  extend ActiveSupport::Concern
@@ -1,3 +1,4 @@
1
+ ##
1
2
  # Locating 是地理定位,表示地理位置和被定位物体之间的关联。
2
3
 
3
4
  class Unidom::Geo::Locating < Unidom::Geo::ApplicationRecord
@@ -14,6 +15,9 @@ class Unidom::Geo::Locating < Unidom::Geo::ApplicationRecord
14
15
  scope :located_is, ->(located) { where located: located }
15
16
  scope :located_by, ->(locator) { where locator: locator }
16
17
 
18
+ ##
19
+ # 将给定的位置与给定的地标关联起来。如:
20
+ # Unidom::Geo::Locating.locate! location: location, located: shop, locator: current_person
17
21
  def self.locate!(location: nil, located: nil, locator: nil, opened_at: Time.now)
18
22
  attributes = { opened_at: opened_at }
19
23
  if locator.present?
@@ -1,3 +1,4 @@
1
+ ##
1
2
  # Location 是地理位置。具体对应到某一个街道地址。
2
3
 
3
4
  class Unidom::Geo::Location < Unidom::Geo::ApplicationRecord
@@ -24,10 +25,16 @@ class Unidom::Geo::Location < Unidom::Geo::ApplicationRecord
24
25
  scope :region_is, ->(region) { where region: region }
25
26
  scope :postal_address_is, ->(postal_address) { where postal_address: postal_address }
26
27
 
28
+ ##
29
+ # 将当前位置与地标关联起来。如:
30
+ # location.locate! shop, by: current_person
27
31
  def locate!(located, by: nil, at: Time.now)
28
32
  locatings.located_is(located).valid_at(now: at).alive.first_or_create! locator: by, opened_at: at
29
33
  end
30
34
 
35
+ ##
36
+ # 判断当前位置与地标之间,是否有有效的关联。如:
37
+ # location.locate? shop
31
38
  def locate?(located, at: Time.now)
32
39
  locatings.located_is(located).valid_at(now: at).alive.exists?
33
40
  end
@@ -3,11 +3,11 @@ module Unidom
3
3
 
4
4
  class Engine < ::Rails::Engine
5
5
 
6
+ include Unidom::Common::EngineExtension
7
+
6
8
  isolate_namespace Unidom::Geo
7
9
 
8
- initializer :append_migrations do |app|
9
- config.paths['db/migrate'].expanded.each { |expanded_path| app.config.paths['db/migrate'] << expanded_path } unless app.root.to_s.match root.to_s
10
- end
10
+ enable_initializer enum_enabled: false, migration_enabled: true
11
11
 
12
12
  end
13
13
 
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Geo
3
- VERSION = '1.4.3'.freeze
3
+ VERSION = '1.4.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-geo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-05 00:00:00.000000000 Z
11
+ date: 2017-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.7.1
19
+ version: '1.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.7.1
26
+ version: '1.8'
27
27
  description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
28
  The Geo domain model engine includes Region, Town, and Location models. Unidom (统一领域对象模型)是一系列的领域模型引擎。地理领域模型引擎包括行政区划、乡镇和街道地址的模型。
29
29
  email: