Class: Pubid::Ieee::Identifiers::JointDevelopment

Inherits:
Base show all
Defined in:
lib/pubid/ieee/identifiers/joint_development.rb

Overview

Handles ISO/IEC/IEEE joint development identifiers Supports bidirectional format conversion between IEEE and ISO representations

Joint development standards can be represented in two formats based on lead party:

IEEE-led Format (lead_party: “IEEE”):

ISO/IEC/IEEE P26511/D8-2018
- Publishers: ISO/IEC/IEEE (slash-separated)
- Lead party: IEEE (drives development)
- P prefix indicates IEEE project (draft)
- /D8 indicates IEEE draft notation
- Dash before year

ISO-led Format (lead_party: “ISO”):

ISO/IEC/IEEE FDIS 26511:2018
- Publishers: ISO/IEC/IEEE (slash-separated)
- Lead party: ISO (drives development)
- ISO stage code (FDIS) instead of P/D notation
- Colon before year

Key principles:

  • Lead party determines canonical format

  • NO equivalence mapping (as per IEEE staff guidance)

  • “P” prefix means IEEE project (any stage)

  • ISO stages and IEEE drafts can coexist but are not equivalent

  • Format conversion preserves semantic meaning within each system

Instance Attribute Summary

Attributes inherited from Base

#code_obj, #draft_obj

Instance Method Summary collapse

Methods inherited from Base

#code, #draft, #draft_month, parse, parse_single

Methods inherited from Pubid::Identifier

#base_identifier, #eql?, #exclude, #hash, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, #render, #resolve_urn_generator, #root, #to_mr_string, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code

Constructor Details

#initialize(**args) ⇒ JointDevelopment

Returns a new instance of JointDevelopment.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/pubid/ieee/identifiers/joint_development.rb', line 41

def initialize(**args)
  # Call super FIRST to initialize Lutaml::Model attributes
  super

  # Then handle typed_stage
  if args[:typed_stage].is_a?(Components::TypedStage)
    self.typed_stage = args[:typed_stage]
  end

  # Set publishers
  if args[:publishers]
    self.publishers = args[:publishers]
  elsif args[:publisher] && args[:copublisher]
    # Combine publisher and copublisher into publishers array
    self.publishers = [args[:publisher], *args[:copublisher]].compact
  end

  # Set lead_party if not provided - default to first publisher
  if args[:lead_party]
    self.lead_party = args[:lead_party]
  elsif publishers && !publishers.empty?
    # Lead party defaults to first publisher if not explicitly set
    # Builder should override this with detected lead party
    self.lead_party = publishers.first
  end
end

Instance Method Details

#canonical_formatSymbol

Canonical format based on lead party

Returns:

  • (Symbol)

    :ieee or :iso



70
71
72
73
74
75
76
77
78
79
# File 'lib/pubid/ieee/identifiers/joint_development.rb', line 70

def canonical_format
  case lead_party
  when "IEEE", "AIEE"
    :ieee
  when "ISO", "IEC"
    :iso
  else
    :ieee # default to IEEE format
  end
end

#to_s(format: canonical_format) ⇒ String

Convert to string representation

Parameters:

  • format (Symbol) (defaults to: canonical_format)

    :ieee or :iso (defaults to canonical_format)

Returns:

  • (String)

    formatted identifier



84
85
86
87
88
89
90
91
92
93
# File 'lib/pubid/ieee/identifiers/joint_development.rb', line 84

def to_s(format: canonical_format)
  case format
  when :iso
    to_iso_format
  when :ieee
    to_ieee_format
  else
    to_ieee_format
  end
end