Sha256: 582dd53488682a9564717b89ca6b3c30242cc94fb095a11ccb90d690bd44c28b

Contents?: true

Size: 593 Bytes

Versions: 26

Compression:

Stored size: 593 Bytes

Contents

# frozen_string_literal: true

module Dato
  module Local
    module FieldType
      class LatLon
        attr_reader :latitude, :longitude

        def self.parse(value, _repo)
          value && new(value[:latitude], value[:longitude])
        end

        def initialize(latitude, longitude)
          @latitude = latitude
          @longitude = longitude
        end

        def values
          [latitude, longitude]
        end

        def to_hash(*_args)
          {
            latitude: latitude,
            longitude: longitude
          }
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
dato-0.6.16 lib/dato/local/field_type/lat_lon.rb
dato-0.6.15 lib/dato/local/field_type/lat_lon.rb
dato-0.6.14 lib/dato/local/field_type/lat_lon.rb
dato-0.6.12 lib/dato/local/field_type/lat_lon.rb
dato-0.6.11 lib/dato/local/field_type/lat_lon.rb
dato-0.6.10 lib/dato/local/field_type/lat_lon.rb