activerecord-postgis 0.6.1 → 0.6.2

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
  SHA256:
3
- metadata.gz: 85a0e8ab2ce4078be403c88613a3f3cbd5e75b5eb10513c17a4bd907a32f3932
4
- data.tar.gz: f742b5aea859d34e0ecb5886e14e29dc5e0741aba3203436d92bcf41f5fb4f8a
3
+ metadata.gz: c4caab5fe6b63c11ebb789f2e77cb8997ac1c495333cc08e2cba397e043916fa
4
+ data.tar.gz: a8688b2c439daf278f07fe7c9ff00fd791ef82f964a74f0032ec088e5a495144
5
5
  SHA512:
6
- metadata.gz: 72576fb86dcbecf612b6e887b797ca6da99f8a7d48f53c6f5428e55bd93650f6b51d9166a948fe3ad8cde910da4a1f69ad34751ee17d0b1a8c513d6434a386c8
7
- data.tar.gz: ce5ce36d298aa6532284bf0c5b01f6f2ec5a395559a08bc4114c8dff9cf8f47b9a9079edab5edee896eaece08b506b67a813756f6e2d8ac800ee8d6846cc9f1f
6
+ metadata.gz: 55b212ec58aff548cd55062d88728b75383859b246a66cd49cda54e1f86d2acde0ad3b6a3df8d921e4e7678efe99c9898f78efa4557e978b9361e520996bd823
7
+ data.tar.gz: 5c33782d1350c14a8f8bf1edbe3ae8495bd40527293241f80e5d6b140f964c70b953d2f3fc8b513a1c5df8fb218c896540d6fcc80645ef4573c7e7460abc11e0
@@ -25,9 +25,9 @@ module ActiveRecord
25
25
  has_z = geo_part.end_with?("Z") || geo_part.end_with?("ZM")
26
26
  has_m = geo_part.end_with?("M") || geo_part.end_with?("ZM")
27
27
  end
28
- elsif o.limit.is_a?(String) && o.limit.include?(",")
28
+ elsif o.options[:limit].is_a?(String) && o.options[:limit].include?(",")
29
29
  # Fallback to parsing limit string (for schema loading)
30
- geo_part, srid_part = o.limit.split(",", 2)
30
+ geo_part, srid_part = o.options[:limit].split(",", 2)
31
31
  srid = srid_part.to_i if srid_part && !srid_part.empty?
32
32
  if geo_part
33
33
  has_z = geo_part.end_with?("Z") || geo_part.end_with?("ZM")
@@ -42,9 +42,9 @@ module ActiveRecord
42
42
  end
43
43
 
44
44
  sql_type = type_to_sql(o.type.to_sym,
45
- limit: o.options[:spatial_sql] || o.limit,
46
- precision: o.precision,
47
- scale: o.scale,
45
+ limit: o.options[:spatial_sql] || o.options[:limit],
46
+ precision: o.options[:precision],
47
+ scale: o.options[:scale],
48
48
  srid: srid,
49
49
  geographic: geographic,
50
50
  has_z: has_z,
@@ -22,8 +22,9 @@ module ActiveRecord
22
22
  end
23
23
 
24
24
  if spatial_column_type?(col_type)
25
- if (limit = options.delete(:limit)) && limit.is_a?(::Hash)
26
- options.merge!(limit)
25
+ case (limit = options.delete(:limit))
26
+ when ::Hash then options.merge!(limit)
27
+ when ::String then options.reverse_merge!(ColumnDefinitionUtils.options_from_limit(limit))
27
28
  end
28
29
 
29
30
  # Set geographic option for geography types
@@ -125,6 +126,17 @@ module ActiveRecord
125
126
  end
126
127
  end
127
128
 
129
+ # Inverse of limit_from_options: "POINTZ,4326" => { srid: 4326, has_z: true }
130
+ def options_from_limit(limit)
131
+ geo_part, srid_part = limit.split(",", 2)
132
+ dimensions = geo_part.to_s.upcase[/(ZM|Z|M)\z/].to_s
133
+ options = {}
134
+ options[:srid] = Integer(srid_part) if srid_part.present?
135
+ options[:has_z] = true if dimensions.include?("Z")
136
+ options[:has_m] = true if dimensions.include?("M")
137
+ options
138
+ end
139
+
128
140
  def limit_from_options(type, options = {})
129
141
  has_z = options[:has_z] ? "Z" : ""
130
142
  has_m = options[:has_m] ? "M" : ""
@@ -3,7 +3,7 @@
3
3
  module ActiveRecord
4
4
  module ConnectionAdapters
5
5
  module PostGIS
6
- VERSION = "0.6.1"
6
+ VERSION = "0.6.2"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
139
- rubygems_version: 4.0.10
139
+ rubygems_version: 4.0.20
140
140
  specification_version: 4
141
141
  summary: PostGIS Type support for ActiveRecord
142
142
  test_files: []