Class: Pubid::Plateau::UrnParser
- Inherits:
-
UrnParser::Base
- Object
- UrnParser::Base
- Pubid::Plateau::UrnParser
- Defined in:
- lib/pubid/plateau/urn_parser.rb
Overview
Parses Plateau URNs back into identifiers.
UrnGenerator emits:
urn:plateau:{type}:{number}[:{annex}]
type is one of: handbook, tr (technical report), an (annex), or another lowercase type string. Annex is a zero-padded 2-digit string when present.
Examples:
-
urn:plateau:handbook:00 → PLATEAU Handbook #00
-
urn:plateau:tr:01 → PLATEAU Technical Report #01
Constant Summary collapse
- TYPE_MAP =
{ "handbook" => "Handbook", "tr" => "Technical Report", "an" => "Annex", }.freeze
Instance Method Summary collapse
Methods inherited from UrnParser::Base
Instance Method Details
#parse_urn(urn) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/pubid/plateau/urn_parser.rb', line 23 def parse_urn(urn) body = strip_namespace(urn) parts = split_parts(body) type_token = parts.fetch(0) number = parts.fetch(1) annex = parts[2] text = "PLATEAU #{display_type(type_token)} ##{number}" text += "-#{annex}" if annex flavor_parse(text) end |