Class: Pubid::Ogc::UrnParser

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

Overview

Parses OGC URNs back into identifiers.

UrnGenerator emits: urn:ogc:<year>:<number>[:<revision>].

Examples:

  • urn:ogc:25:023 → 25-023
  • urn:ogc:24:032:r1 → 24-032r1

Instance Method Summary collapse

Methods inherited from UrnParser::Base

parse

Instance Method Details

#parse_urn(urn) ⇒ Object



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

def parse_urn(urn)
  body = strip_namespace(urn)
  year, number, revision = split_parts(body)
  text = "#{year}-#{number}"
  text += revision.to_s if revision
  flavor_parse(text)
end