Class: Pubid::Ansi::UrnParser

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

Overview

Parses ANSI URNs back into identifiers.

UrnGenerator emits: ‘urn:ansi:code:year` where the code carries the alpha-numeric designation (e.g., “X3.4”).

Examples:

  • urn:ansi:X3.4:1963 → ANSI X3.4:1963

Instance Method Summary collapse

Methods inherited from UrnParser::Base

parse

Instance Method Details

#parse_urn(urn) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/pubid/ansi/urn_parser.rb', line 13

def parse_urn(urn)
  body = strip_namespace(urn)
  parts = split_parts(body)
  code, year = parts
  text = "ANSI #{code}"
  text += ":#{year}" if year
  flavor_parse(text)
end