Class: Pubid::Sae::UrnParser

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

Overview

Parses SAE URNs back into identifiers.

UrnGenerator emits:

urn:sae:{type|std}:{number}:{year}

where slot is overwritten with the publisher string when a publisher is set. The common single-publisher case keeps slot = “sae”.

Examples:

  • urn:sae:j:300:2019 → SAE J300:2019

  • urn:sae:air:500 → SAE AIR500

  • urn:sae:ams:5000:2020 → SAE AMS5000:2020

Instance Method Summary collapse

Methods inherited from UrnParser::Base

parse

Instance Method Details

#parse_urn(urn) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/pubid/sae/urn_parser.rb', line 17

def parse_urn(urn)
  body = strip_namespace(urn)
  parts = split_parts(body)

  type_token, number, year = parts
  text = build_text(type_token, number, year)
  flavor_parse(text)
end