Class: Dato::Local::FieldType::LatLon

Inherits:
Object
  • Object
show all
Defined in:
lib/dato/local/field_type/lat_lon.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(latitude, longitude) ⇒ LatLon

Returns a new instance of LatLon.



13
14
15
16
# File 'lib/dato/local/field_type/lat_lon.rb', line 13

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

Instance Attribute Details

#latitudeObject (readonly)

Returns the value of attribute latitude.



7
8
9
# File 'lib/dato/local/field_type/lat_lon.rb', line 7

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



7
8
9
# File 'lib/dato/local/field_type/lat_lon.rb', line 7

def longitude
  @longitude
end

Class Method Details

.parse(value, _repo) ⇒ Object



9
10
11
# File 'lib/dato/local/field_type/lat_lon.rb', line 9

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

Instance Method Details

#to_hash(*_args) ⇒ Object



22
23
24
25
26
27
# File 'lib/dato/local/field_type/lat_lon.rb', line 22

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

#valuesObject



18
19
20
# File 'lib/dato/local/field_type/lat_lon.rb', line 18

def values
  [latitude, longitude]
end