Class: Pubid::Nist::UrnParser
- Inherits:
-
UrnParser::Base
- Object
- UrnParser::Base
- Pubid::Nist::UrnParser
- Defined in:
- lib/pubid/nist/urn_parser.rb
Overview
Parses NIST URNs back into identifiers.
UrnGenerator emits:
urn:nist:{type}:{code}[.{revision}].supp
type is the lowercase series (sp, fips, ir, nistcir, …). code is the alphanumeric designation. revision is ‘rN` when present. The `.supp` suffix marks the series as supplementable.
Examples:
-
urn:nist:sp:800-53.supp → NIST SP 800-53
-
urn:nist:sp:800-53.r5.supp → NIST SP 800-53r5
-
urn:nist:fips:199.supp → NIST FIPS 199
Constant Summary collapse
- TYPE_UPCASE =
{ "sp" => "SP", "fips" => "FIPS", "ir" => "IR", "nistcir" => "NISTCIR", "nbs" => "NBS", "nistir" => "NISTIR", "csf" => "CSF", "gcr" => "GCR", "itl" => "ITL", "jres" => "JRES", "lcirc" => "LCIRC", "mon" => "MONO", "ms" => "MS", "nsrds" => "NSRDS", "tn" => "TN", "wp" => "WP", }.freeze
Instance Method Summary collapse
Methods inherited from UrnParser::Base
Instance Method Details
#parse_urn(urn) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/pubid/nist/urn_parser.rb', line 38 def parse_urn(urn) body = strip_namespace(urn) parts = split_parts(body) type_token, payload = parts code, revision = parse_payload(payload) text = "NIST #{type_label(type_token)} #{code}" text += revision if revision flavor_parse(text) end |