lib/datacite/mapping/geo_location_box.rb in datacite-mapping-0.3.0 vs lib/datacite/mapping/geo_location_box.rb in datacite-mapping-0.4.0

- old
+ new

@@ -60,28 +60,32 @@ end def south_latitude=(value) raise ArgumentError, 'South latitude cannot be nil' unless value raise ArgumentError, "#{value} is not a valid south latitude" unless value >= -90 && value <= 90 + @south_latitude = value end def west_longitude=(value) raise ArgumentError, 'West longitude cannot be nil' unless value raise ArgumentError, "#{value} is not a valid west longitude" unless value >= -180 && value <= 180 + @west_longitude = value end def north_latitude=(value) raise ArgumentError, 'North latitude cannot be nil' unless value raise ArgumentError, "#{value} is not a valid north latitude" unless value >= -90 && value <= 90 + @north_latitude = value end def east_longitude=(value) raise ArgumentError, 'East longitude cannot be nil' unless value raise ArgumentError, "#{value} is not a valid east longitude" unless value >= -180 && value <= 180 + @east_longitude = value end # Gets the box coordinates as a string. # @return [String] the coordinates of the box as a sequence of four numbers, in the order S W N E. @@ -94,9 +98,10 @@ # @param other [GeoLocationBox] the box to compare # @return [Fixnum, nil] the sort order (-1, 0, or 1), or nil if `other` is not a # {GeoLocationBox} def <=>(other) return nil unless other.class == self.class + %i[south_latitude west_longitude north_latitude east_longitude].each do |c| order = send(c) <=> other.send(c) return order if order.nonzero? end 0