Class: Pubid::CenCenelec::UrnParser
- Inherits:
-
UrnParser::Base
- Object
- UrnParser::Base
- Pubid::CenCenelec::UrnParser
- Defined in:
- lib/pubid/cen_cenelec/urn_parser.rb
Overview
Parses CEN/CENELEC URNs back into identifiers.
UrnGenerator emits: ‘urn:cen:type:number:year` where type is the lowercase document class (en, etsg, ts, tr).
Examples:
-
urn:cen:en:9001:2015 → EN 9001:2015
Instance Method Summary collapse
-
#flavor_name ⇒ Object
UrnGenerator uses “cen” rather than “cencenelec” as the namespace.
- #parse_urn(urn) ⇒ Object
Methods inherited from UrnParser::Base
Instance Method Details
#flavor_name ⇒ Object
UrnGenerator uses “cen” rather than “cencenelec” as the namespace.
14 15 16 |
# File 'lib/pubid/cen_cenelec/urn_parser.rb', line 14 def flavor_name "cen" end |
#parse_urn(urn) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/pubid/cen_cenelec/urn_parser.rb', line 18 def parse_urn(urn) body = strip_namespace(urn) parts = split_parts(body) type_token, number, year = parts text = "#{type_token.upcase} #{number}" text += ":#{year}" if year flavor_parse(text) end |