Sha256: 0a5b02cced567a47d4b307ee00e24b99398fb0cb626cd305311f0f187f415e57

Contents?: true

Size: 584 Bytes

Versions: 3

Compression:

Stored size: 584 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
          {
            latitude: latitude,
            longitude: longitude
          }
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dato-0.3.6 lib/dato/local/field_type/lat_lon.rb
dato-0.3.5 lib/dato/local/field_type/lat_lon.rb
dato-0.3.3 lib/dato/local/field_type/lat_lon.rb