Class: Pubid::Ieee::Identifiers::JointDevelopment
- Inherits:
-
Pubid::Ieee::Identifier
- Object
- Lutaml::Model::Serializable
- Pubid::Identifier
- Pubid::Ieee::Identifier
- Pubid::Ieee::Identifiers::JointDevelopment
- Includes:
- CodeNumber
- 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 Pubid::Ieee::Identifier
Instance Method Summary collapse
-
#canonical_format ⇒ Symbol
Canonical format based on lead party.
-
#copublisher ⇒ Object
Override to ensure proper copublisher handling.
-
#initialize(args = {}, **kwargs) ⇒ JointDevelopment
constructor
Accepts keyword args or a single positional hash (the base #exclude/matching rebuild passes the latter) — see Identifier#initialize.
-
#publisher ⇒ Object
Override to ensure proper publisher handling.
-
#to_hash(*args) ⇒ Object
publisher/copublisherare derived frompublishers(the source of truth, which IS serialized). -
#to_s(format: canonical_format, trademark: false) ⇒ String
Convert to string representation JointDevelopment has its own dual-format logic (IEEE vs ISO) that doesn't go through the format registry renderer.
Methods included from CodeNumber
#code_obj, included, #rebuild_code_obj_from_split, #sync_split_from_code_obj
Methods inherited from Pubid::Ieee::Identifier
additional_identifier_classes, #code, #draft, #draft_month, #exclude, from_hash, #mr_number_with_part, #mr_publisher, #mr_type, #mr_year, parse, parse_single
Methods inherited from Pubid::Identifier
apply_mappings, #base, #base_document, concrete_class_for, #dated_version_of?, #draft_of?, #drop_supplements, #edition_of?, #eql?, #exclude, from_hash, #has_supplement?, #hash, #includes?, #matches?, #mr_all_parts, #mr_edition, #mr_languages, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_subpart, #mr_supplement_suffix, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, polymorphic_type_map, #related_to?, #render, #resolve_urn_generator, #root, #sibling_of?, #supplement_of?, #to_mr_string, #to_slug, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code, #year
Constructor Details
#initialize(args = {}, **kwargs) ⇒ JointDevelopment
Accepts keyword args or a single positional hash (the base #exclude/matching rebuild passes the latter) — see Identifier#initialize.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/pubid/ieee/identifiers/joint_development.rb', line 49 def initialize(args = {}, **kwargs) args = args.merge(kwargs) unless kwargs.empty? # Call super FIRST to initialize Lutaml::Model attributes super(args) # 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_format ⇒ Symbol
Canonical format based on lead party
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/pubid/ieee/identifiers/joint_development.rb', line 79 def canonical_format case lead_party when "IEEE", "AIEE" :ieee when "ISO", "IEC" :iso else :ieee # default to IEEE format end end |
#copublisher ⇒ Object
Override to ensure proper copublisher handling
197 198 199 |
# File 'lib/pubid/ieee/identifiers/joint_development.rb', line 197 def copublisher publishers&.drop(1) || super end |
#publisher ⇒ Object
Override to ensure proper publisher handling
192 193 194 |
# File 'lib/pubid/ieee/identifiers/joint_development.rb', line 192 def publisher publishers&.first || super end |
#to_hash(*args) ⇒ Object
publisher/copublisher are derived from publishers (the source
of truth, which IS serialized). Emitting them too breaks the canonical
round-trip: the derived publisher is default-omitted on the parse
path but re-emitted after from_hash (the override returns
publishers.first, not the default). Drop both — publishers rebuilds
them. (JointDevelopment is a top-level root, never nested, so a
to_hash-level drop is sufficient.)
208 209 210 211 212 213 214 215 |
# File 'lib/pubid/ieee/identifiers/joint_development.rb', line 208 def to_hash(*args) hash = super if hash.is_a?(::Hash) hash.delete("publisher") hash.delete("copublisher") end hash end |
#to_s(format: canonical_format, trademark: false) ⇒ String
Convert to string representation JointDevelopment has its own dual-format logic (IEEE vs ISO) that doesn't go through the format registry renderer.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/pubid/ieee/identifiers/joint_development.rb', line 96 def to_s(format: canonical_format, trademark: false) # The mark goes after the code number, before the draft and the year # ("ISO/IEC/IEEE P26511™/D8-2018"), so it is threaded into the # format builders rather than appended to the finished string. mark = if trademark Pubid::Ieee.trademark_symbol_for(code&.number, code&.prefix, publishers: publishers) else "" end case format when :iso to_iso_format(mark) else to_ieee_format(mark) end end |