Class: Pubid::Jcgm::UrnParser

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

Overview

Parses JCGM URNs back into identifiers.

UrnGenerator emits: ‘urn:jcgm:number:year`.

Examples:

  • urn:jcgm:200:2012 → JCGM 200:2012

  • urn:jcgm:100:2008 → JCGM 100:2008

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/jcgm/urn_parser.rb', line 13

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