Class: Pubid::Iso::UrnGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/pubid/iso/urn_generator.rb

Overview

Generates RFC 5141-bis compliant URNs from ISO identifiers

Components render themselves via ‘component.render(context: URN_CONTEXT)`; this class orchestrates them into the URN string structure.

RFC 5141-bis extensions implemented:

  • Explicit language specification (explicit > implicit)

  • Extended copublisher syntax (dynamic combinations)

  • Extended document types (DIR, DIR-SUP, IWA-SUP)

  • Typed stage codes (WD, CD, DIS, FDIS, PDAM, etc.)

  • Supplement chain ordering semantics

  • Bundled identifier syntax

Constant Summary collapse

TYPED_STAGE_MAP =

Stage code mapping for RFC 5141-bis typed stages

{
  wd: "WD",
  wds: "WDS",
  cd: "CD",
  cdv: "CDV",
  dis: "DIS",
  fdis: "FDIS",
  pdam: "PDAM",
  dam: "DAM",
  fdamd: "FDAM",
  dcor: "DCOR",
  fdcor: "FDCOR",
  cdts: "CDTS",
  dts: "DTS",
  fdts: "FDTS",
}.freeze
TYPE_CODE_MAP =
{
  dir: "dir",
  dir_sup: "dir-sup",
  iwa_sup: "iwa-sup",
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier) ⇒ UrnGenerator

Returns a new instance of UrnGenerator.



47
48
49
# File 'lib/pubid/iso/urn_generator.rb', line 47

def initialize(identifier)
  @identifier = identifier
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier.



45
46
47
# File 'lib/pubid/iso/urn_generator.rb', line 45

def identifier
  @identifier
end

Instance Method Details

#generateObject



51
52
53
54
55
56
57
# File 'lib/pubid/iso/urn_generator.rb', line 51

def generate
  if identifier.is_a?(SupplementIdentifier)
    generate_supplement_urn
  else
    generate_base_urn
  end
end