Class: Superstore::Types::GeoPointType
- Defined in:
- lib/superstore/types/geo_point_type.rb
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#cast_value(value) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/superstore/types/geo_point_type.rb', line 10 def cast_value(value) case value when String cast_value value.split(/[,\s]+/) when Array to_float_or_nil(lat: value[0], lon: value[1]) when Hash to_float_or_nil(lat: value[:lat] || value['lat'], lon: value[:lon] || value['lon']) end end |
#deserialize(value) ⇒ Object
6 7 8 |
# File 'lib/superstore/types/geo_point_type.rb', line 6 def deserialize(value) {lat: value[:lat] || value['lat'], lon: value[:lon] || value['lon']} if value end |