Class: Pubid::Ieee::Identifiers::ProjectDraftIdentifier

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

Overview

Project Draft Identifier Format: “IEEE P1234/D5, July 2019” where P1234 is the project number and D5 is the draft version This is distinct from a StandardIdentifier - the “P” indicates project status, not a code prefix like “C” in “C57.12”

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, #publisher, #to_s

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_s, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code

Constructor Details

#initialize(**args) ⇒ ProjectDraftIdentifier

Override initialize to strip “P” prefix from code before creating Code object The “P” is reflected in the typed_stage, not in the Code component itself



14
15
16
17
18
19
20
21
22
# File 'lib/pubid/ieee/identifiers/project_draft_identifier.rb', line 14

def initialize(**args)
  # If code is provided with "P" prefix (e.g., "P1234"), strip it
  if args[:code].is_a?(String) && args[:code].start_with?("P")
    args[:code] = args[:code][1..] # Strip leading "P"
  end

  # Call parent initialize with modified code
  super
end