Class: Pubid::Iec::UrnGenerator

Inherits:
UrnGenerator::Base show all
Defined in:
lib/pubid/iec/urn_generator.rb

Overview

Generates IEC URNs in the legacy positional format used as ground truth by relaton-data-iec:

urn:iec:std:{publisher}:{number}[-{part}]:{date}:{type}:{deliverable}:{language}[:{adjuncts}]

e.g. urn:iec:std:iec:60050-102:2007::: (type after date; trailing empty type/deliverable/language slots). This is a port of relaton-iec’s Relaton::Iec.code_to_urn operating on identifier.to_s, which round-trips faithfully. The all-parts series URN is the one exception: it omits the language slot (8 fields), so it has a dedicated branch.

Constant Summary collapse

DELIVERABLES =

Deliverable markers occupying the positional deliverable slot.

/cmv|csv|exv|prv|rlv|ser/.freeze

Instance Attribute Summary

Attributes inherited from UrnGenerator::Base

#identifier

Instance Method Summary collapse

Methods inherited from UrnGenerator::Base

#initialize, #maybe, #urn_edition, #urn_namespace, #urn_number, #urn_part, #urn_publisher, #urn_subpart, #urn_type, #urn_year

Constructor Details

This class inherits a constructor from Pubid::UrnGenerator::Base

Instance Method Details

#generateObject



19
20
21
22
23
# File 'lib/pubid/iec/urn_generator.rb', line 19

def generate
  return series_urn if identifier.respond_to?(:all_parts) && identifier.all_parts

  code_to_urn(identifier.to_s, urn_language)
end