Class: Pubid::Iec::Identifiers::WorkingDocument

Inherits:
Base show all
Defined in:
lib/pubid/iec/identifiers/working_document.rb

Overview

Working Document identifier class Single Responsibility: Represents IEC Working Documents with TC attribution Also handles Working Programmes with PWI/PNW stage-first format Formats:

Working Programme: "PWI TR 100-36 ED1"
Working Document: "100/3705(F)/FDIS"

Constant Summary collapse

TYPED_STAGES =

Working documents have no TYPED_STAGES - they use PROJECT_STAGES only

[].freeze
PROJECT_STAGES =

Working document stages

{}.freeze

Constants inherited from Pubid::Iec::Identifier

Pubid::Iec::Identifier::IEC_TYPE_MAP

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#number_portion, #validate!

Methods inherited from SingleIdentifier

#edition_portion, #language_portion, #number_portion, #publisher_portion

Methods inherited from Pubid::Iec::Identifier

#all_parts_from_kv, #all_parts_to_kv, #build_code, build_type_map, #copublishers_from_kv, #copublishers_to_kv, default_publisher, #emit_code, from_hash, #number_from_kv, #number_to_kv, parse, #part_from_kv, #part_to_kv, published_typed_stage, #publisher_from_kv, #publisher_to_kv, #stage_from_kv, #stage_iteration_from_kv, #stage_iteration_to_kv, #stage_to_kv, #subpart_from_kv, #subpart_to_kv, #type, #year_from_kv, #year_to_kv

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, #year

Constructor Details

This class inherits a constructor from Pubid::Identifier

Class Method Details

.typeObject



26
27
28
29
# File 'lib/pubid/iec/identifiers/working_document.rb', line 26

def self.type
  { key: :wd,
    web: :working_document, title: "Working Document", short: "WD" }
end

Instance Method Details

#stageObject

Return stage object for PWI/PNW stage



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/pubid/iec/identifiers/working_document.rb', line 32

def stage
  return nil unless wp_stage

  # Map PWI/PNW to stage codes
  stage_map = {
    "PWI" => "pwi",
    "PNW" => "pnw",
  }
  stage_code = stage_map[wp_stage]
  return nil unless stage_code

  @stage ||= ::Pubid::Components::Stage.new(stage_code: stage_code)
end

#to_s(**opts) ⇒ Object



46
47
48
# File 'lib/pubid/iec/identifiers/working_document.rb', line 46

def to_s(**opts)
  render(format: :human, **opts)
end