Class: INatGet::Data::Helper::Field::Location Private

Inherits:
INatGet::Data::Helper::Field show all
Defined in:
lib/inat-get/data/helpers/defs/location.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Direct Known Subclasses

ScalarLocation

Instance Attribute Summary

Attributes inherited from INatGet::Data::Helper::Field

#helper, #key

Instance Method Summary collapse

Methods inherited from INatGet::Data::Helper::Field

#initialize, #to_api, #to_sequel

Constructor Details

This class inherits a constructor from INatGet::Data::Helper::Field

Instance Method Details

#prepare(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
14
15
16
# File 'lib/inat-get/data/helpers/defs/location.rb', line 11

def prepare value
  {
    latitude: (value[0] .. value[0]),
    longitude: (value[1] .. value[1])
  }
end

#valid?(value) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


7
8
9
# File 'lib/inat-get/data/helpers/defs/location.rb', line 7

def valid? value
  value.nil? || (value.is_a?(Array) && value.size == 2 && value[0].is_a?(Float) && value[1].is_a?(Float))
end