Class: Pubid::Iec::Identifiers::WorkingDocument
- Inherits:
-
Base
- Object
- Lutaml::Model::Serializable
- Pubid::Identifier
- Pubid::Iec::Identifier
- SingleIdentifier
- Base
- Pubid::Iec::Identifiers::WorkingDocument
- 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
Class Method Summary collapse
Instance Method Summary collapse
-
#stage ⇒ Object
Return stage object for PWI/PNW stage.
- #to_s(_format = :short) ⇒ Object
Methods inherited from Base
Methods inherited from SingleIdentifier
#edition_portion, #language_portion, #number_portion, #publisher_portion
Methods inherited from Pubid::Iec::Identifier
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::Identifier
Class Method Details
.type ⇒ Object
28 29 30 |
# File 'lib/pubid/iec/identifiers/working_document.rb', line 28 def self.type { key: :wd, title: "Working Document", short: "WD" } end |
Instance Method Details
#stage ⇒ Object
Return stage object for PWI/PNW stage
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/pubid/iec/identifiers/working_document.rb', line 33 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(_format = :short) ⇒ Object
47 48 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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/pubid/iec/identifiers/working_document.rb', line 47 def to_s(_format = :short) # Working Programme format: "PWI TR 100-36 ED1" or "IEC/PWI 60038" if wp_stage parts = [] # Include publisher if present (for IEC/PWI format) if publisher parts << publisher.body if copublishers&.any? parts << "/#{copublishers.map(&:body).join('/')}" end parts << "/" end parts << wp_stage # Only add wp_type if it exists and is not empty/whitespace if wp_type && !wp_type.strip.empty? parts << " #{wp_type.strip}" end # Render full number with parts if number num_str = number.to_s num_str += "-#{part}" if part && part.to_s != "" num_str += "-#{subpart}" if subpart && subpart.to_s != "" parts << " #{num_str}" end parts << " #{edition}" if edition&.number return parts.join end # Working Document format: "100/3705(F)/FDIS" parts = [] parts << technical_committee if technical_committee # Number with optional language if wd_number num_part = wd_number.to_s num_part += "(#{wd_language})" if wd_language parts << num_part end parts << wd_stage if wd_stage parts.join("/") end |