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

Inherits:
Pubid::Ieee::Identifier show all
Includes:
CodeNumber
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"

Constant Summary collapse

TYPED_STAGES =
[
  Components::TypedStage.new(
    abbr: ["P"],
    stage_code: "draft",
    type_code: "draft",
    ieee_draft_equivalent: "P",
    approval_status: "unapproved",
    project_status: true,
  ),
].freeze

Instance Attribute Summary

Attributes inherited from Pubid::Ieee::Identifier

#code_obj, #draft_obj

Class Method Summary collapse

Instance Method Summary collapse

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

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_hash, #to_mr_string, #to_s, #to_slug, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code, #year

Constructor Details

#initialize(args = {}, **kwargs) ⇒ 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. Accepts keyword args or a single positional hash (the base #exclude/matching rebuild passes the latter).



36
37
38
39
40
41
42
43
44
45
# File 'lib/pubid/ieee/identifiers/project_draft_identifier.rb', line 36

def initialize(args = {}, **kwargs)
  args = kwargs.empty? ? args.dup : args.merge(kwargs)
  # 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 (positional hash)
  super(args)
end

Class Method Details

.typeObject



28
29
30
# File 'lib/pubid/ieee/identifiers/project_draft_identifier.rb', line 28

def self.type
  { key: :P, title: "Project Draft", short: "P" }
end