lib/mongoid_geospatial/wrappers/rgeo.rb in mongoid_geospatial-2.5.1 vs lib/mongoid_geospatial/wrappers/rgeo.rb in mongoid_geospatial-2.7.0
- old
+ new
@@ -3,13 +3,16 @@
module Mongoid
module Geospatial
class Point
- delegate :distance, :to => :to_geo
def to_geo
RGeo::Geographic.spherical_factory.point x, y
+ end
+
+ def distance other
+ to_geo.distance other.to_geo
end
def self.mongoize(obj)
case obj
when RGeo::Geographic::SphericalPointImpl then [obj.x, obj.y]