Class: Pubid::Iana::UrnParser
- Inherits:
-
UrnParser::Base
- Object
- UrnParser::Base
- Pubid::Iana::UrnParser
- Defined in:
- lib/pubid/iana/urn_parser.rb
Overview
Parses IANA URNs back into identifiers.
UrnGenerator emits urn:iana:<registry>[:<sub_registry>]; this rebuilds
the bare slug and delegates to the flavor's text parser (which normalizes
it back to the "IANA "-prefixed printed form).
Examples:
- urn:iana:calipso -> IANA calipso
- urn:iana:_6lowpan-parameters:lowpan_nhc -> IANA _6lowpan-parameters/lowpan_nhc
Instance Method Summary collapse
Methods inherited from UrnParser::Base
Instance Method Details
#parse_urn(urn) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/pubid/iana/urn_parser.rb', line 16 def parse_urn(urn) body = strip_namespace(urn) registry, sub_registry = split_parts(body) slug = sub_registry ? "#{registry}/#{sub_registry}" : registry flavor_parse(slug) end |