Class: Pubid::Oiml::UrnParser

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

Overview

Parses OIML URNs back into identifiers.

UrnGenerator emits: urn:oiml:{type}:{locator} where type is the lowercase document class — single letter for typed documents (r, d, b, g, …) or the word "bulletin" for Bulletin issues. The locator is the number-part-subpart for typed documents and the YYYY-II-SS tuple for Bulletins.

Examples:

  • urn:oiml:r:111-1 → OIML R 111-1
  • urn:oiml:d:1 → OIML D 1
  • urn:oiml:bulletin:2026-02-11 → OIML Bulletin 2026-02-11

Instance Method Summary collapse

Methods inherited from UrnParser::Base

parse

Instance Method Details

#parse_urn(urn) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/pubid/oiml/urn_parser.rb', line 18

def parse_urn(urn)
  body = strip_namespace(urn)
  parts = split_parts(body)
  type_token = parts.fetch(0)
  number = parts[1]

  text = "OIML #{display_type(type_token)}"
  text += " #{number}" if number
  flavor_parse(text)
end