Class: Pubid::Jis::UrnParser

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

Overview

Parses JIS URNs back into identifiers.

UrnGenerator emits: ‘urn:jis:code:year` where code is the classification letter + number (e.g., “X 0201”).

Examples:

  • urn:jis:X 0201:1997 → JIS X 0201:1997

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

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