Class: RGeo::ActiveRecord::SpatialNamedFunction

Inherits:
Arel::Nodes::NamedFunction
  • Object
show all
Includes:
SpatialExpressions
Defined in:
lib/rgeo/active_record/arel_spatial_queries.rb

Overview

A NamedFunction subclass that keeps track of the spatial-ness of the arguments and return values, so that it can provide context to visitors that want to interpret syntax differently when dealing with spatial elements.

Instance Method Summary collapse

Methods included from SpatialExpressions

#st_area, #st_asbinary, #st_astext, #st_boundary, #st_buffer, #st_centroid, #st_contains, #st_convexhull, #st_crosses, #st_difference, #st_dimension, #st_disjoint, #st_distance, #st_endpoint, #st_envelope, #st_equals, #st_exteriorring, #st_function, #st_geometryn, #st_geometrytype, #st_interiorringn, #st_intersection, #st_intersects, #st_isclosed, #st_isempty, #st_isring, #st_issimple, #st_length, #st_m, #st_numgeometries, #st_numinteriorrings, #st_numpoints, #st_overlaps, #st_pointn, #st_pointonsurface, #st_relate, #st_srid, #st_startpoint, #st_symdifference, #st_touches, #st_union, #st_within, #st_x, #st_y, #st_z

Constructor Details

#initialize(name, expr, spatial_flags = [], aliaz = nil) ⇒ SpatialNamedFunction

Returns a new instance of SpatialNamedFunction.



100
101
102
103
# File 'lib/rgeo/active_record/arel_spatial_queries.rb', line 100

def initialize(name, expr, spatial_flags = [], aliaz = nil)
  super(name, expr, aliaz)
  @spatial_flags = spatial_flags
end

Instance Method Details

#spatial_argument?(index) ⇒ Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/rgeo/active_record/arel_spatial_queries.rb', line 109

def spatial_argument?(index)
  @spatial_flags[index + 1]
end

#spatial_result?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/rgeo/active_record/arel_spatial_queries.rb', line 105

def spatial_result?
  @spatial_flags.first
end