Class: Pubid::Idf::UrnParser
- Inherits:
-
UrnParser::Base
- Object
- UrnParser::Base
- Pubid::Idf::UrnParser
- Defined in:
- lib/pubid/idf/urn_parser.rb
Overview
Parses IDF URNs back into identifiers.
UrnGenerator emits: ‘urn:idf:number:year:` with a trailing empty field (a known quirk of the generator).
Examples:
-
urn:idf:87:2019: → IDF 87:2019
-
urn:idf:100: → IDF 100
Instance Method Summary collapse
Methods inherited from UrnParser::Base
Instance Method Details
#parse_urn(urn) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/pubid/idf/urn_parser.rb', line 14 def parse_urn(urn) body = strip_namespace(urn) parts = split_parts(body).reject(&:empty?) number, year = parts text = "IDF #{number}" text += ":#{year}" if year flavor_parse(text) end |