Sha256: b3fb80c5f812d108ef91fa0380824b1d00b7e7bcb57d646c24df9043bb7d5fab

Contents?: true

Size: 594 Bytes

Versions: 3

Compression:

Stored size: 594 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

3 entries across 3 versions & 1 rubygems

Version Path
dato-0.8.3 lib/dato/local/field_type/lat_lon.rb
dato-0.8.2 lib/dato/local/field_type/lat_lon.rb
dato-0.8.1 lib/dato/local/field_type/lat_lon.rb