Skip to content

Commit

Permalink
allow code to work in earlier ruby versions
Browse files Browse the repository at this point in the history
  • Loading branch information
peetucket committed Nov 21, 2023
1 parent da09b46 commit a2a53e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/iiif/v3/presentation/nav_place.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module Presentation
class NavPlace < IIIF::V3::AbstractResource
Rect = Struct.new(:coord1, :coord2)

COORD_REGEX = /(?<hemisphere>[NSEW]) (?<degrees>\d+)[°⁰*] ?(?<minutes>\d+)?[ʹ']? ?(?<seconds>\d+)?[ʺ"]?/

def initialize(coordinate_texts:, base_uri:)
@coordinate_texts = coordinate_texts
@base_uri = base_uri
Expand All @@ -22,7 +24,7 @@ def build
{
id: "#{base_uri}/feature-collection/1",
type: 'FeatureCollection',
features:
features: features
}
end

Expand All @@ -42,8 +44,6 @@ def coordinates
end.compact
end

COORD_REGEX = /(?<hemisphere>[NSEW]) (?<degrees>\d+)[°⁰*] ?(?<minutes>\d+)?[ʹ']? ?(?<seconds>\d+)?[ʺ"]?/

def coord_for(long_str, lat_str)
long_matcher = long_str.match(COORD_REGEX)
lat_matcher = lat_str.match(COORD_REGEX)
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/iiif/v3/presentation/nav_place_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe IIIF::V3::Presentation::NavPlace do
let(:subject) { described_class.new(coordinate_texts:, base_uri:) }
let(:subject) { described_class.new(coordinate_texts: coordinate_texts, base_uri: base_uri) }
let(:base_uri) { "https://purl.stanford.edu" }
let(:invalid_coordinates) { ["bogus", "stuff", "is", "here"] }
let(:valid_coordinates) do
Expand Down

0 comments on commit a2a53e1

Please sign in to comment.