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

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 Maps TypedStage stage_code to URN stage abbreviation

{
  wd: "WD",          # Working Draft
  wds: "WDS",        # Working Draft Study
  cd: "CD",          # Committee Draft
  cdv: "CDV",        # Committee Draft for Vote
  dis: "DIS",        # Draft International Standard
  fdis: "FDIS",      # Final Draft International Standard
  pdam: "PDAM",      # Proposed Draft Amendment
  dam: "DAM",        # Draft Amendment
  fdamd: "FDAM",     # Final Draft Amendment (note: stage_code is fdamd)
  dcor: "DCOR",      # Draft Corrigendum
  fdcor: "FDCOR",    # Final Draft Corrigendum
  cdts: "CDTS",      # Committee Draft Technical Specification
  dts: "DTS",        # Draft Technical Specification
  fdts: "FDTS",      # Final Draft Technical Specification
}.freeze
TYPE_CODE_MAP =

Document type mapping for RFC 5141-bis extended types

{
  dir: "dir",           # Directive
  dir_sup: "dir-sup",   # Directive Supplement
  iwa_sup: "iwa-sup",   # IWA Supplement
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier) ⇒ UrnGenerator

Initialize URN generator

Parameters:

  • identifier (Identifier)

    The ISO identifier to generate URN for



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

def initialize(identifier)
  @identifier = identifier
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier.



41
42
43
# File 'lib/pubid/iso/urn_generator.rb', line 41

def identifier
  @identifier
end

Instance Method Details

#generateString

Generate complete URN string

Returns:

  • (String)

    The URN in format urn:iso:std:…



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

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