Sha256: e703f421c17453314aee715bd30c06e82706ed15b6b29bc41b94ee06a974a557
Contents?: true
Size: 534 Bytes
Versions: 1
Compression:
Stored size: 534 Bytes
Contents
class Typero::PointType < Typero::Type def set if @value.present? if @value.include?('/@') point = @value.split('/@', 2).last.split(',') @value = [point[0], point[1]].join(',') end unless @value.include?('POINT') point = @value.sub(/,\s*/, ' ') @value = 'SRID=4326;POINT(%s)' % point end end end def validate raise TypeError, error_for(:unallowed_characters_error) unless @value =~ /^SRID=4326;POINT\(/ end def db_field [:geography, {}] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
typero-0.5.2 | ./lib/typero/type/point.rb |