rgeo-ar 0.6.0 → 0.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: c6450384669367d1c94d13c408784df96c62f410
4
- data.tar.gz: a569d6e0b7c8ed5f0bf2981e15d8df5c3877c353
3
+ metadata.gz: 07f4e76f082da2fd612d850b83cd7d30194755b9
4
+ data.tar.gz: d847ade0068d38b282b81775545d61431fffddcb
5
5
  SHA512:
6
- metadata.gz: 8cb09d66ed6ffcc134563e065f95b0d1311cd672fe49cec0aa0e3bd57ad6ede7ad83ebb8b1301418dce2511dfa366306012c6c4c3127e6f0e1a0d413e2b25606
7
- data.tar.gz: e6b2c1824c98ad1f8004d51c9fa4cab9ee1ce19b42ba089ad603b5e56b5ccac6a4b2ce50849e58cf6ff9ba8436cc5f385b824fb3fc60e5d2a37324bf814bc699
6
+ metadata.gz: 4ec86f237ef08314c084f795d55366fa0be9c345451a82352dce1d1ba4edd414d0da3ef29551e4ef98f21da97e08e5e5c0ead220093018e97fe44f9cbca3046a
7
+ data.tar.gz: 989f88e983a96cbc1fb615df1f2035580ec09606bc4c79d5bef533a7e279dd89171047996951600aef23f0bdd00537ac3a39fc1cf1db7b0c4d325d683d2d3c67
@@ -31,6 +31,5 @@
31
31
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
32
  # POSSIBILITY OF SUCH DAMAGE.
33
33
  # -----------------------------------------------------------------------------
34
- ;
35
34
 
36
35
  require 'rgeo/active_record'
@@ -31,8 +31,6 @@
31
31
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
32
  # POSSIBILITY OF SUCH DAMAGE.
33
33
  # -----------------------------------------------------------------------------
34
- ;
35
-
36
34
 
37
35
  # Dependencies
38
36
  require 'rgeo'
@@ -31,8 +31,6 @@
31
31
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
32
  # POSSIBILITY OF SUCH DAMAGE.
33
33
  # -----------------------------------------------------------------------------
34
- ;
35
-
36
34
 
37
35
  require 'rgeo/active_record'
38
36
  require 'yaml'
@@ -150,12 +148,10 @@ module RGeo
150
148
 
151
149
  # Clear out any ActiveRecord caches that are present.
152
150
  # Different Rails versions use different types of caches.
153
- has_schema_cache_ = false
154
151
  klass_.connection_pool.with_connection do |c_|
155
152
  if c_.respond_to?(:schema_cache)
156
153
  # 3.2.x and 4.0.x
157
154
  c_.schema_cache.clear!
158
- has_schema_cache_ = true
159
155
  end
160
156
  if c_.respond_to?(:clear_cache!)
161
157
  # 3.1 and above
@@ -164,10 +160,6 @@ module RGeo
164
160
  # All 3.x and 4.0
165
161
  c_.clear_query_cache
166
162
  end
167
- if !has_schema_cache_ && klass_.connection_pool.respond_to?(:clear_cache!)
168
- # 3.1.x only
169
- klass_.connection_pool.clear_cache!
170
- end
171
163
  end
172
164
 
173
165
 
@@ -31,8 +31,6 @@
31
31
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
32
  # POSSIBILITY OF SUCH DAMAGE.
33
33
  # -----------------------------------------------------------------------------
34
- ;
35
-
36
34
 
37
35
  require 'active_record'
38
36
 
@@ -31,14 +31,9 @@
31
31
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
32
  # POSSIBILITY OF SUCH DAMAGE.
33
33
  # -----------------------------------------------------------------------------
34
- ;
35
-
36
34
 
37
35
  module RGeo
38
-
39
36
  module ActiveRecord
40
-
41
-
42
37
  # A set of common Arel visitor hacks for spatial ToSql visitors.
43
38
  # Generally, a spatial ActiveRecord adapter should provide a custom
44
39
  # ToSql Arel visitor that includes and customizes this module.
@@ -47,7 +42,6 @@ module RGeo
47
42
 
48
43
  module SpatialToSql
49
44
 
50
-
51
45
  # Map a standard OGC SQL function name to the actual name used by
52
46
  # a particular database. This method should take a name and
53
47
  # return either the changed name or the original name.
@@ -56,7 +50,6 @@ module RGeo
56
50
  standard_name_
57
51
  end
58
52
 
59
-
60
53
  # Visit the SpatialNamedFunction node. This operates similarly to
61
54
  # the standard NamedFunction node, but it performs function name
62
55
  # mapping for the database, and it also uses the type information
@@ -71,11 +64,9 @@ module RGeo
71
64
  "#{name_}(#{node_.distinct ? 'DISTINCT ' : ''}#{exprs_.join(', ')})#{node_.alias ? " AS #{visit(node_.alias, *args)}" : ''}"
72
65
  end
73
66
 
74
-
75
67
  # Generates SQL for a spatial node.
76
68
  # The node must be a string (in which case it is treated as WKT),
77
69
  # an RGeo feature, or a spatial attribute.
78
-
79
70
  def visit_in_spatial_context(node_, *args)
80
71
  case node_
81
72
  when ::String
@@ -88,50 +79,24 @@ module RGeo
88
79
  visit(node_, *args)
89
80
  end
90
81
  end
91
-
92
-
93
82
  end
94
83
 
95
-
96
84
  # This node wraps an RGeo feature and gives it spatial expression
97
85
  # constructors.
98
-
99
86
  class SpatialConstantNode
100
-
101
87
  include ::RGeo::ActiveRecord::SpatialExpressions
102
88
 
103
-
104
89
  # The delegate should be the RGeo feature.
105
-
106
90
  def initialize(delegate_)
107
91
  @delegate = delegate_
108
92
  end
109
93
 
110
-
111
94
  # Return the RGeo feature
112
-
113
95
  attr_reader :delegate
114
-
115
-
116
96
  end
117
97
 
118
-
119
98
  # :stopdoc:
120
99
 
121
-
122
- # Hack Arel Attributes dispatcher to recognize geometry columns.
123
- # This is deprecated but necessary to support legacy Arel versions.
124
-
125
- if ::Arel::Attributes.method_defined?(:for)
126
- module ArelAttributesLegacyClassMethods
127
- def for(column_)
128
- column_.type == :spatial ? Attribute : super
129
- end
130
- end
131
- ::Arel::Attributes.extend(ArelAttributesLegacyClassMethods)
132
- end
133
-
134
-
135
100
  # Make sure the standard Arel visitors can handle RGeo feature objects
136
101
  # by default.
137
102
 
@@ -157,59 +122,36 @@ module RGeo
157
122
  alias :visit_RGeo_Cartesian_BoundingBox :visit_String
158
123
  end
159
124
 
160
-
161
125
  # Add tools to build spatial structures in the AST.
162
- # This stuff requires Arel 2.1 or later.
163
126
 
164
- if defined?(::Arel::Nodes::NamedFunction)
127
+ # Allow chaining of spatial expressions from attributes
128
+ ::Arel::Attribute.class_eval do
129
+ include ::RGeo::ActiveRecord::SpatialExpressions
130
+ end
165
131
 
166
- # Allow chaining of predications from named functions
167
- # (Some older versions of Arel didn't do this.)
168
- ::Arel::Nodes::NamedFunction.class_eval do
169
- include ::Arel::Predications unless include?(::Arel::Predications)
170
- end
132
+ # A NamedFunction subclass that keeps track of the spatial-ness of
133
+ # the arguments and return values, so that it can provide context to
134
+ # visitors that want to interpret syntax differently when dealing with
135
+ # spatial elements.
136
+ class SpatialNamedFunction < ::Arel::Nodes::NamedFunction
137
+ include ::RGeo::ActiveRecord::SpatialExpressions
171
138
 
172
- # Allow chaining of spatial expressions from attributes
173
- ::Arel::Attribute.class_eval do
174
- include ::RGeo::ActiveRecord::SpatialExpressions
139
+ def initialize(name_, expr_, spatial_flags_=[], aliaz_=nil)
140
+ super(name_, expr_, aliaz_)
141
+ @spatial_flags = spatial_flags_
175
142
  end
176
143
 
177
-
178
- # A NamedFunction subclass that keeps track of the spatial-ness of
179
- # the arguments and return values, so that it can provide context to
180
- # visitors that want to interpret syntax differently when dealing with
181
- # spatial elements.
182
-
183
- class SpatialNamedFunction < ::Arel::Nodes::NamedFunction
184
-
185
- include ::RGeo::ActiveRecord::SpatialExpressions
186
-
187
- def initialize(name_, expr_, spatial_flags_=[], aliaz_=nil)
188
- super(name_, expr_, aliaz_)
189
- @spatial_flags = spatial_flags_
190
- end
191
-
192
- def spatial_result?
193
- @spatial_flags.first
194
- end
195
-
196
- def spatial_argument?(index_)
197
- @spatial_flags[index_+1]
198
- end
199
-
144
+ def spatial_result?
145
+ @spatial_flags.first
200
146
  end
201
147
 
202
- else
203
-
204
- # A dummy SpatialNamedFunction for pre-2.1 versions of Arel.
205
- class SpatialNamedFunction; end
148
+ def spatial_argument?(index_)
149
+ @spatial_flags[index_+1]
150
+ end
206
151
 
207
152
  end
208
153
 
209
-
210
154
  # :startdoc:
211
155
 
212
-
213
156
  end
214
-
215
157
  end
@@ -31,7 +31,6 @@
31
31
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
32
  # POSSIBILITY OF SUCH DAMAGE.
33
33
  # -----------------------------------------------------------------------------
34
- ;
35
34
 
36
35
 
37
36
  require 'active_support/core_ext/class' # Workaround for a missing require in ActiveRecord 3.2.1
@@ -31,8 +31,6 @@
31
31
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
32
  # POSSIBILITY OF SUCH DAMAGE.
33
33
  # -----------------------------------------------------------------------------
34
- ;
35
-
36
34
 
37
35
  module RGeo
38
36
 
@@ -31,8 +31,6 @@
31
31
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
32
  # POSSIBILITY OF SUCH DAMAGE.
33
33
  # -----------------------------------------------------------------------------
34
- ;
35
-
36
34
 
37
35
  module RGeo
38
36
 
@@ -31,7 +31,6 @@
31
31
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
32
  # POSSIBILITY OF SUCH DAMAGE.
33
33
  # -----------------------------------------------------------------------------
34
- ;
35
34
 
36
35
 
37
36
  module RGeo
@@ -34,6 +34,6 @@
34
34
 
35
35
  module RGeo
36
36
  module ActiveRecord
37
- VERSION = '0.6.0'.freeze
37
+ VERSION = '0.6.1'.freeze
38
38
  end
39
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgeo-ar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma