Class: Pubid::Ashrae::UrnParser

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

Overview

Parses ASHRAE URNs back into identifiers.

UrnGenerator emits:

urn:ashrae:{number}:{year}:{type}[:{suffix}][:amd.{N}][:reaff.{Y}]

The type token follows the year; the human-readable form prefixes the type (“ASHRAE Standard 90.1-2019”). The year separator is ‘-`.

Examples:

  • urn:ashrae:90.1:2019:standard → ASHRAE Standard 90.1-2019

Instance Method Summary collapse

Methods inherited from UrnParser::Base

parse

Instance Method Details

#parse_urn(urn) ⇒ Object



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

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

  number, year = parts
  text = "ASHRAE Standard #{number}"
  text += "-#{year}" if year
  flavor_parse(text)
end