mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-17 06:26:22 +00:00
23 lines
402 B
Ruby
23 lines
402 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Define un campo de coordenadas geográficas
|
|
class MetadataGeo < MetadataTemplate
|
|
def default_value
|
|
{ 'lat' => nil, 'lng' => nil }
|
|
end
|
|
|
|
def empty?
|
|
value == default_value
|
|
end
|
|
|
|
def to_param
|
|
{ name => %i[lat lng] }
|
|
end
|
|
|
|
def save
|
|
self[:value] = {
|
|
'lat' => self[:value]['lat'].to_f,
|
|
'lng' => self[:value]['lng'].to_f
|
|
}
|
|
end
|
|
end
|