Class: Dato::Local::FieldType::LatLon
- Inherits:
-
Object
- Object
- Dato::Local::FieldType::LatLon
- Defined in:
- lib/dato/local/field_type/lat_lon.rb
Instance Attribute Summary collapse
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(latitude, longitude) ⇒ LatLon
constructor
A new instance of LatLon.
- #to_hash(*_args) ⇒ Object
- #values ⇒ Object
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
#latitude ⇒ Object (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 |
#longitude ⇒ Object (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 |
#values ⇒ Object
18 19 20 |
# File 'lib/dato/local/field_type/lat_lon.rb', line 18 def values [latitude, longitude] end |