Class: Pubid::Cie::Identifiers::JointPublished

Inherits:
SingleIdentifier show all
Defined in:
lib/pubid/cie/identifiers/joint_published.rb

Overview

Joint published identifier for CIE Handles CIE ISO, CIE IEC, CIE ISO/CIE patterns

Instance Method Summary collapse

Methods inherited from SingleIdentifier

#publisher

Methods inherited from Pubid::Cie::Identifier

parse

Instance Method Details

#to_sObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/pubid/cie/identifiers/joint_published.rb', line 17

def to_s
  parts = ["CIE", copublisher]

  # Document type (TR)
  parts << doc_type if doc_type

  # Stage (DIS)
  parts << stage if stage

  # Code (number-part) - special handling for IEC dot separator
  if code
    code_str = code.to_s
    # For IEC copublisher, if code has a part, use dot not slash/dash
    if copublisher == "IEC" && code.part
      code_str = "#{code.number}.#{code.part}"
    end
    parts << code_str
  end

  result = parts.join(" ")

  # Date - use the actual captured separator
  if year
    separator = date_separator == "colon" ? ":" : "-"
    result += "#{separator}#{year}"
  end

  # Language (always parenthetical for joint published)
  result += language.to_s if language

  result
end