Class: Agave::Local::FieldType::LatLon

Inherits:
Object
  • Object
show all
Defined in:
lib/agave/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.



12
13
14
15
# File 'lib/agave/local/field_type/lat_lon.rb', line 12

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

Instance Attribute Details

#latitudeObject (readonly)

Returns the value of attribute latitude.



6
7
8
# File 'lib/agave/local/field_type/lat_lon.rb', line 6

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



6
7
8
# File 'lib/agave/local/field_type/lat_lon.rb', line 6

def longitude
  @longitude
end

Class Method Details

.parse(value, _repo) ⇒ Object



8
9
10
# File 'lib/agave/local/field_type/lat_lon.rb', line 8

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

Instance Method Details

#to_hash(*_args) ⇒ Object



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

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

#valuesObject



17
18
19
# File 'lib/agave/local/field_type/lat_lon.rb', line 17

def values
  [latitude, longitude]
end