Class: Datacite::Mapping::GeoLocationBoxNode

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

Overview

XML mapping node for <geoLocationBox/>

Instance Method Summary collapse

Instance Method Details

#to_value(xml_text)

Converts a whitespace-separated list of coordinates to a Datacite::Mapping::GeoLocationBox.

Parameters:

  • xml_text (String)

    the coordinates, in the order lat long lat long.



128
129
130
131
132
# File 'lib/datacite/mapping/geo_location_box.rb', line 128

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