Class: Pubid::Cie::Identifiers::Supplement

Inherits:
SupplementIdentifier show all
Defined in:
lib/pubid/cie/identifiers/supplement.rb

Overview

Supplement identifier for CIE Handles -SPN and -SPN.P notation with recursive base parsing Examples: CIE 121-SP1:2009, CIE 198-SP1.4:2011, CIE DIS 025-SP1/E:2019

Instance Method Summary collapse

Methods inherited from Pubid::Cie::Identifier

parse

Instance Method Details

#to_sObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/pubid/cie/identifiers/supplement.rb', line 19

def to_s
  parts = ["CIE"]

  # Stage if present (DIS/DS)
  parts << stage if stage

  # Build base number and supplement
  result = parts.join(" ")
  result += " #{base_number}-SP#{supplement_number}"

  # Add part if present (e.g., ".4" in "SP1.4")
  result += ".#{supplement_part}" if supplement_part

  # Add language with slash if present (before year)
  if language && language.format == "slash_colon"
    result += "/#{language.code}"
  end

  # Add year with colon (supplements always use current style)
  result += ":#{year}" if year

  result
end