Class: Pubid::Ieee::Identifiers::MultiNumberedIdentifier

Inherits:
Base
  • Object
show all
Defined in:
lib/pubid/ieee/identifiers/multi_numbered_identifier.rb

Overview

Multi-Numbered Identifier Represents a single document published under multiple numbers Examples:

  • “IEEE Std 1299/C62.22.1-1996” (same document, two numbers)

  • “IEEE Std 960-1989, Std 1177-1989” (same document, two numbers)

Instance Attribute Summary collapse

Attributes inherited from Base

#code_obj, #draft_obj

Instance Method Summary collapse

Methods inherited from Base

#draft, #draft_month, #initialize, parse, parse_single

Methods inherited from Pubid::Identifier

#base_identifier, #eql?, #exclude, #hash, #initialize, #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

This class inherits a constructor from Pubid::Ieee::Identifiers::Base

Instance Attribute Details

#primary_identifierObject

Primary identifier (main IEEE standard number) Stored as-is (Lutaml model type checking doesn’t work with polymorphic identifiers)



14
15
16
# File 'lib/pubid/ieee/identifiers/multi_numbered_identifier.rb', line 14

def primary_identifier
  @primary_identifier
end

#secondary_identifierObject

Secondary identifier (additional number for same document)



17
18
19
# File 'lib/pubid/ieee/identifiers/multi_numbered_identifier.rb', line 17

def secondary_identifier
  @secondary_identifier
end

Instance Method Details

#codeObject



41
42
43
# File 'lib/pubid/ieee/identifiers/multi_numbered_identifier.rb', line 41

def code
  primary_identifier&.code
end

#publisherObject



37
38
39
# File 'lib/pubid/ieee/identifiers/multi_numbered_identifier.rb', line 37

def publisher
  primary_identifier&.publisher
end

#to_sObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/pubid/ieee/identifiers/multi_numbered_identifier.rb', line 19

def to_s
  # Format: PRIMARY/SECONDARY or PRIMARY, SECONDARY
  # The format depends on the original input
  return primary_identifier.to_s unless secondary_identifier

  # Check if the secondary identifier starts with "C" (like C62.22.1)
  # If so, use slash format (cross-reference style)
  secondary_code = secondary_identifier.code.to_s
  if secondary_code.start_with?("C") && secondary_code.match?(/^C\d+\./)
    # Cross-reference format: IEEE Std 1299/C62.22.1-1996
    "#{primary_identifier}/#{secondary_identifier}"
  else
    # Comma format: IEEE Std 960-1989, Std 1177-1989
    # But we normalize to "and" format for consistency
    "#{primary_identifier} and #{secondary_identifier}"
  end
end

#yearObject



45
46
47
# File 'lib/pubid/ieee/identifiers/multi_numbered_identifier.rb', line 45

def year
  primary_identifier&.year
end