Class: Datacite::Mapping::GeoLocationPointNode

Inherits:
XML::MappingExtensions::NodeBase
  • Object
show all
Defined in:
lib/datacite/mapping/geo_location_point.rb

Overview

XML mapping node for <geoLocationPoint/>

Instance Method Summary collapse

Instance Method Details

#to_value(xml_text)

Converts a whitespace-separated pair of coordinates to a Datacite::Mapping::GeoLocationPoint.

Parameters:

  • xml_text (String)

    the coordinates, in the order lat long.



93
94
95
96
97
# File 'lib/datacite/mapping/geo_location_point.rb', line 93

def to_value(xml_text)
  stripped = xml_text.strip
  coords = stripped.split(/\s+/).map(&:to_f)
  GeoLocationPoint.new(*coords)
end