Class: Pubid::Etsi::UrnParser
- Inherits:
-
UrnParser::Base
- Object
- UrnParser::Base
- Pubid::Etsi::UrnParser
- Defined in:
- lib/pubid/etsi/urn_parser.rb
Overview
Parses ETSI URNs back into identifiers.
UrnGenerator emits:
urn:etsi:{type}:{code}:{version}:{date}[:{supplement_notation}:{number}]
type is the lowercase type abbreviation (en, ets, ts, tr, gs, sr). code is the identifier code with internal whitespace preserved. version is the lowercase Vx.y.z form. date is YYYY or YYYY-MM.
Examples:
-
urn:etsi:en:300 100:v1.1.1:1998-04 → ETSI EN 300 100 V1.1.1 (1998-04)
Instance Method Summary collapse
Methods inherited from UrnParser::Base
Instance Method Details
#parse_urn(urn) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pubid/etsi/urn_parser.rb', line 18 def parse_urn(urn) body = strip_namespace(urn) parts = split_parts(body) type_token = parts.fetch(0).upcase code = parts.fetch(1) version = parts[2] date = parts[3] text = "ETSI #{type_token} #{code}" text += " #{version.upcase}" if version text += " (#{date})" if date flavor_parse(text) end |