rgeo-activerecord 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.2.3 / 2011-01-07
2
+
3
+ * Updated gem dependencies to include Arel 2.0.6, since some earlier Arel versions weren't working. (Reported by Pirmin Kalberer.)
4
+
1
5
  === 0.2.2 / 2011-01-06
2
6
 
3
7
  * Some adjustments to the Arel integration for future Arel compatibility. (Thanks to Aaron Patterson.)
data/README.rdoc CHANGED
@@ -23,8 +23,9 @@ interact directly with this library
23
23
  RGeo::ActiveRecord has the following requirements:
24
24
 
25
25
  * Ruby 1.8.7 or later. Ruby 1.9.2 or later preferred.
26
- * \RGeo 0.2.3 or later.
26
+ * \RGeo 0.2.4 or later.
27
27
  * \ActiveRecord 3.0.3 or later. Earlier versions will not work.
28
+ * \Arel 2.0.6 or later. Earlier versions will not work.
28
29
 
29
30
  Generally, \ActiveRecord adapters which depend on this module should be
30
31
  installed as gems, and they will install this module automatically as
data/Version CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -37,37 +37,13 @@
37
37
  require 'arel'
38
38
 
39
39
 
40
- # The rgeo-activerecord gem installs several hacks into Arel to support
41
- # geometry values and geometry-valued columns.
42
- #
43
- # To support geometry values as nodes in the Arel AST, we need to provide
44
- # a way for visitors to handle nodes that are feature objects.
45
- # Generally, this is accomplished by writing (or aliasing) methods in the
46
- # visitor of the form "visit_<classname>". Arel will dispatch to a method
47
- # based on the class of the object in the AST. Unfortunately, RGeo feature
48
- # objects usually have opaque classes; plus, there are so many different
49
- # classes as to make it infeasible to list all of them. Therefore, we hack
50
- # Arel::Visitors::Visitor#visit to explicitly recognize the
51
- # RGeo::Feature::Instance marker module, and we define the method
52
- # visit_RGeo_Feature_Instance. In the various visitors (Dot, DepthFirst,
53
- # and ToSql), this method is aliased in the same way as the other raw
54
- # values. For the ToSql visitor, this means aliasing to visit_String,
55
- # which then depends on the quoting implemented by the connection adapter
56
- # to convert to a SQL literal.
57
- #
58
- # To support geometry columns, we define Arel::Attributes::Geometry, and
59
- # we hack Arel::Attributes::for to map the :geometry column type to that
60
- # new attribute. We then add the appropriate alias for the
61
- # visit_Arel_Attributes_Geometry method to the visitors.
62
-
40
+ # The rgeo-activerecord gem installs several minor hacks into Arel to
41
+ # support geometry values in the AST.
63
42
  module Arel
64
43
 
65
- # :stopdoc:
66
-
67
-
68
44
  # Hack Attributes dispatcher to recognize geometry columns.
69
45
  # This is deprecated but necessary to support legacy Arel versions.
70
- module Attributes
46
+ module Attributes # :nodoc:
71
47
  class << self
72
48
  if method_defined?(:for)
73
49
  alias_method :for_without_geometry, :for
@@ -78,25 +54,25 @@ module Arel
78
54
  end
79
55
  end
80
56
 
57
+ # Visitors are modified to handle RGeo::Feature::Instance objects in
58
+ # the AST.
81
59
  module Visitors
82
60
 
83
- # Dot visitor handlers for geometry attributes and values.
61
+ # RGeo adds visit_RGeo_Feature_Instance to the Dot visitor.
84
62
  class Dot
85
63
  alias :visit_RGeo_Feature_Instance :visit_String
86
64
  end
87
65
 
88
- # DepthFirst visitor handlers for geometry attributes and values.
66
+ # RGeo adds visit_RGeo_Feature_Instance to the DepthFirst visitor.
89
67
  class DepthFirst
90
68
  alias :visit_RGeo_Feature_Instance :terminal
91
69
  end
92
70
 
93
- # ToSql visitor handlers for geometry attributes and values.
71
+ # RGeo adds visit_RGeo_Feature_Instance to the ToSql visitor.
94
72
  class ToSql
95
73
  alias :visit_RGeo_Feature_Instance :visit_String
96
74
  end
97
75
 
98
76
  end
99
77
 
100
- # :startdoc:
101
-
102
78
  end
@@ -39,7 +39,7 @@ module RGeo
39
39
  module ActiveRecord
40
40
 
41
41
 
42
- # A set of tools for hacking Rake tasks.
42
+ # A set of tools for hacking ActiveRecord's Rake tasks.
43
43
 
44
44
  module TaskHacker
45
45
 
@@ -70,6 +70,18 @@ module RGeo
70
70
  class << self
71
71
 
72
72
 
73
+ # Modify a named ActiveRecord rake task.
74
+ # The task must be of the form that hinges on the database adapter
75
+ # name. You must provide the fully-qualified name of the rake task
76
+ # to modify, the Rails environment for which to get the database
77
+ # configuration (which may be nil to use the current Rails.env),
78
+ # a Regexp or String identifying the adapter name for which to
79
+ # modify the rake task, and a block. If the database adapter
80
+ # associated with the given environment matches the given pattern,
81
+ # then the rake task's action(s) will be replaced by the given
82
+ # block. The block will be passed the environment's database
83
+ # configuration hash.
84
+
73
85
  def modify(name_, env_, pattern_, &block_)
74
86
  ::Rake::Task[name_].actions.unshift(Action.new(env_, pattern_, block_))
75
87
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 2
9
- version: 0.2.2
8
+ - 3
9
+ version: 0.2.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Azuma
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-06 00:00:00 -08:00
17
+ date: 2011-01-07 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -47,6 +47,21 @@ dependencies:
47
47
  version: 3.0.3
48
48
  type: :runtime
49
49
  version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: arel
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 2
60
+ - 0
61
+ - 6
62
+ version: 2.0.6
63
+ type: :runtime
64
+ version_requirements: *id003
50
65
  description: RGeo is a geospatial data library for Ruby. RGeo::ActiveRecord is an optional RGeo module providing some spatial extensions to ActiveRecord, as well as common tools used by RGeo-based spatial adapters.
51
66
  email: dazuma@gmail.com
52
67
  executables: []