Class: CocinaDisplay::Geospatial::BoundingBoxParser
- Inherits:
-
CoordinatesParser
- Object
- CoordinatesParser
- CocinaDisplay::Geospatial::BoundingBoxParser
- Defined in:
- lib/cocina_display/geospatial.rb
Overview
Base class for bounding box parsers.
Direct Known Subclasses
Constant Summary
Constants inherited from CoordinatesParser
Class Method Summary collapse
-
.parse(input_str) ⇒ BoundingBox?
Parse the input string into a BoundingBox, or nil if parsing fails.
Methods inherited from CoordinatesParser
Class Method Details
.parse(input_str) ⇒ BoundingBox?
Parse the input string into a BoundingBox, or nil if parsing fails.
404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/cocina_display/geospatial.rb', line 404 def self.parse(input_str) matches = input_str.match(self::PATTERN) return unless matches west = normalize_coord(matches[:west]) east = normalize_coord(matches[:east]) south = normalize_coord(matches[:south]) north = normalize_coord(matches[:north]) BoundingBox.from_coords(west: west, east: east, north: north, south: south) end |