Class: Pubid::Bipm::UrnParser

Inherits:
UrnParser::Base show all
Defined in:
lib/pubid/bipm/urn_parser.rb

Overview

Inverts UrnGenerator, rebuilding the identifier directly from the URN fields (rather than reconstructing a printed string) because the printed forms carry surface detail — meeting ordinals, French wording — that the canonical URN intentionally omits.

Instance Method Summary collapse

Methods inherited from UrnParser::Base

parse

Instance Method Details

#parse_urn(urn) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/pubid/bipm/urn_parser.rb', line 10

def parse_urn(urn)
  body = strip_namespace(urn)
  parts = body.split(":", -1)

  case parts.first
  when "metrologia" then build_metrologia(parts)
  when "si-brochure" then build_si_brochure(parts)
  else build_group_leading(parts)
  end
end