lib/mongoid/geospatial/geometry_field.rb in mongoid-geospatial-5.0.0 vs lib/mongoid/geospatial/geometry_field.rb in mongoid-geospatial-5.1.0

- old
+ new

@@ -15,21 +15,23 @@ # Returns [bottom left, top right] # # @return [Array] containing 2 points # def bounding_box - max_x, min_x = -Float::MAX, Float::MAX - max_y, min_y = -Float::MAX, Float::MAX + max_x = -Float::MAX + min_x = Float::MAX + max_y = -Float::MAX + min_y = Float::MAX each do |point| max_y = point[1] if point[1] > max_y min_y = point[1] if point[1] < min_y max_x = point[0] if point[0] > max_x min_x = point[0] if point[0] < min_x end [[min_x, min_y], [max_x, max_y]] end - alias_method :bbox, :bounding_box + alias bbox bounding_box # # Determines the 5 points geometry bounding box. # Useful to use with Mongoid #within_geometry # @@ -51,10 +53,10 @@ # def center_point min, max = *bbox [(min[0] + max[0]) / 2.0, (min[1] + max[1]) / 2.0] end - alias_method :center, :center_point + alias center center_point # # Generates a radius from the point # # @param [Numeric] r radius