spatial_features 1.6.0 → 1.6.1

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: 22436d934425f3bf26fa67267809556fee323e29
4
- data.tar.gz: 61ffeaba1a567cde42cd084c3ef058389dc10595
3
+ metadata.gz: c4613b63bcb5c5ac6eff245ae9c2cda4ef38b948
4
+ data.tar.gz: 7f6d3a777c72868e754a3d452dc1f086bea2d194
5
5
  SHA512:
6
- metadata.gz: 7f4569629dbefd9a0d2f338135229ab285471d16a2ecbe52a1db52b2f0eacb3e23d29f24547bcd9066617d8071f05a2606254faa371ebe0878b8f37e56203a50
7
- data.tar.gz: d46d59474311d6171ebcea73a6576ae4419cb6600a6a34cdbf294210880d8812fc30afe8d77021d5645ef8df0a9455f6d4af5fceee1c0779e59ccf1792d4b83f
6
+ metadata.gz: caea9449c010f38ed4648254d3a67383be6cbcf79171c34e50e0a61af422da01561261a22e96c54ca3d4fa928f10b9aa92aefba28061337fe231168e5cb861d0
7
+ data.tar.gz: aed8dea2e9ed4344aec3fb8aa4886143734cedc95a33677b9b642e62c377220ec482269626cb540dc9507a5def1863c48e1fd9da58923a9f1acf8fb50ed84e1d
@@ -2,6 +2,18 @@ module SpatialFeatures
2
2
  mattr_accessor :default_cache_buffer_in_meters
3
3
  self.default_cache_buffer_in_meters = 100
4
4
 
5
+ def self.update_proximity(*klasses)
6
+ klasses.permutation(2).each do |klass, clazz|
7
+ klass.without_spatial_cache(clazz).find_each do |record|
8
+ cache_record_proximity(record, clazz)
9
+ end
10
+ end
11
+
12
+ klasses.each do |klass|
13
+ update_stale_spatial_cache(klass)
14
+ end
15
+ end
16
+
5
17
  def self.update_spatial_cache(scope)
6
18
  scope.with_stale_spatial_cache.includes(:spatial_cache).find_each do |record|
7
19
  record.spatial_cache.each do |spatial_cache|
@@ -9,6 +9,8 @@ module SpatialFeatures
9
9
  scope :with_features, lambda { joins(:features).uniq }
10
10
  scope :without_features, lambda { joins("LEFT OUTER JOIN features ON features.spatial_model_type = '#{name}' AND features.spatial_model_id = #{table_name}.id").where("features.id IS NULL") }
11
11
 
12
+ scope :with_spatial_cache, lambda {|klass| joins(:spatial_cache).where(:spatial_caches => { :intersection_model_type => klass }).uniq }
13
+ scope :without_spatial_cache, lambda {|klass| where.not(:id => with_spatial_cache(klass)) }
12
14
  scope :with_stale_spatial_cache, lambda { joins(:spatial_cache).where("#{table_name}.features_hash != spatial_caches.features_hash").uniq } if has_spatial_features_hash?
13
15
 
14
16
  has_many :spatial_cache, :as => :spatial_model, :dependent => :delete_all
@@ -1,3 +1,3 @@
1
1
  module SpatialFeatures
2
- VERSION = "1.6.0"
2
+ VERSION = "1.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spatial_features
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Wallace
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-30 00:00:00.000000000 Z
12
+ date: 2016-08-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails