class Geospatial::Map::Index

Uses dependency injection to generate a class to `load` and `dump` a serialized column.

Attributes

map[RW]

Public Class Methods

dump(point) click to toggle source
# File lib/geospatial/map/index.rb, line 36
def dump(point)
        if point.is_a?(Point)
                point.hash
        elsif point.respond_to?(:to_a)
                map.hash_for_coordinates(point.to_a)
        elsif !point.nil?
                raise ArgumentError.new("Could not convert #{point} on #{map}!")
        end
end
load(hash) click to toggle source
# File lib/geospatial/map/index.rb, line 30
def load(hash)
        if hash
                map.point_for_hash(hash)
        end
end