Class: INatGet::Data::Parser::Part::StrLocation Private
- Inherits:
-
INatGet::Data::Parser::Part
- Object
- INatGet::Data::Parser::Part
- INatGet::Data::Parser::Part::StrLocation
- Defined in:
- lib/inat-get/data/parsers/defs/strlocation.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.
Instance Attribute Summary
Attributes inherited from INatGet::Data::Parser::Part
Instance Method Summary collapse
-
#initialize(parser, source = :location) ⇒ StrLocation
constructor
private
A new instance of StrLocation.
- #parse(source) ⇒ Object private
Constructor Details
#initialize(parser, source = :location) ⇒ StrLocation
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 a new instance of StrLocation.
5 6 7 8 |
# File 'lib/inat-get/data/parsers/defs/strlocation.rb', line 5 def initialize parser, source = :location super parser @source = source end |
Instance Method Details
#parse(source) ⇒ 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.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/inat-get/data/parsers/defs/strlocation.rb', line 10 def parse source value = source[@source] if value && value.is_a?(String) && !value.empty? values = value.split(',').map(&:to_f) { latitude: values[0], longitude: values[1] } else {} end end |