Sha256: 79eb83b06aa1b15fb3e5552f9b958e69a47c561c75d52d5ea3b33eefe279ef2a

Contents?: true

Size: 398 Bytes

Versions: 3

Compression:

Stored size: 398 Bytes

Contents

module Mongoid
  module Location
    class LineString
      include Mongoid::Fields::Serializable

      def self.instantiate name, options = {}
        super
      end

      def serialize(object)
        object.to_a
      end

      def deserialize(object)
        return unless object && !object.empty?
        RGeo::Geographic.spherical_factory.line_string(*object)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid_location-0.3.5 lib/mongoid_location/fields/mongoid2/line_string.rb
mongoid_location-0.3.3 lib/mongoid_location/fields/mongoid2/line_string.rb
mongoid_location-0.3.2 lib/mongoid_location/fields/mongoid2/line_string.rb