Class: Pubid::Ieee::Identifiers::SiStandard

Inherits:
Base show all
Defined in:
lib/pubid/ieee/identifiers/si_standard.rb

Overview

SI Standard (Système International) identifier IEEE/ASTM SI standards for metric system Handles both:

  • SI: Published standards (IEEE/ASTM SI 10-1997)

  • PSI: Proposed SI (drafts: IEEE/ASTM PSI 10/D2, October 2015)

Constant Summary collapse

TYPED_STAGES =

TYPED_STAGES for SI standards

[
  Components::TypedStage.new(
    abbr: ["SI"],
    type_code: "SI",
    stage_code: "published",
  ),
  Components::TypedStage.new(
    abbr: ["PSI"],
    type_code: "SI",
    stage_code: "draft",
  ),
].freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#code_obj

Instance Method Summary collapse

Methods inherited from Base

#code, #draft, #draft_month, #initialize, parse, parse_single, #publisher

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

#draft_objObject

Use proper Draft component (Lutaml::Model object)



31
32
33
# File 'lib/pubid/ieee/identifiers/si_standard.rb', line 31

def draft_obj
  @draft_obj
end

Instance Method Details

#to_sObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/pubid/ieee/identifiers/si_standard.rb', line 33

def to_s
  parts = []

  # Publisher (IEEE/ASTM)
  parts << "IEEE/ASTM"

  # Type (SI or PSI based on typed_stage)
  parts << if typed_stage&.abbr&.include?("PSI")
             "PSI"
           else
             "SI"
           end

  # Code (number) with draft version for PSI
  code_part = code.to_s
  if draft_obj
    # Use Draft component's version attribute
    code_part += "/D#{draft_obj.version}"
  end
  parts << code_part if code

  # Date
  if month && year
    parts << ", #{month} #{year}"
  elsif year
    parts << "-#{year}"
  end

  # Relationships (if present)
  result = parts.join(" ")
  if relationships && !relationships.empty?
    rel_strs = relationships.map(&:to_s)
    result += " (#{rel_strs.join(' / ')})"
  end

  result
end