Sha256: c8e2b603699b3a142aff04402c0e0f1ba721946989c9504a9a68bdf212368174
Contents?: true
Size: 805 Bytes
Versions: 31
Compression:
Stored size: 805 Bytes
Contents
# frozen_string_literal: true module Torque module PostgreSQL class Circle < Struct.new(:x, :y, :r) alias radius r alias radius= r= def center point_class.new(x, y) end def center=(value) parts = value.is_a?(point_class) ? [value.x, value.y] : value[0..1] self.x = parts.first self.y = parts.last end private def point_class Torque::PostgreSQL.config.geometry.point_class end end config.geometry.circle_class ||= ::ActiveRecord.const_set('Circle', Class.new(Circle)) module Adapter module OID class Circle < Torque::PostgreSQL::GeometryBuilder PIECES = %i[x y r].freeze FORMATION = '<(%s,%s),%s>'.freeze end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems