Class: Pubid::Nist::Identifiers::CommercialStandardsMonthly

Inherits:
Base
  • Object
show all
Defined in:
lib/pubid/nist/identifiers/commercial_standards_monthly.rb

Overview

NBS Commercial Standards Monthly Identifier Format: NBS CSM N where N is simple number Example: “NBS CSM 1”, “NBS CSM 40”

Constant Summary collapse

TYPED_STAGES =
[
  Pubid::Components::TypedStage.new(
    abbr: ["CSM", "NBS CSM"],
    stage_code: "published",
    type_code: "csm",
  ),
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#edition_greater?, #extract_edition_number, #initialize, #language, #merge, #revision, #series_code, #translation, #weight

Methods inherited from 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::Nist::Identifiers::Base

Class Method Details

.typeObject



23
24
25
# File 'lib/pubid/nist/identifiers/commercial_standards_monthly.rb', line 23

def type
  { key: :csm, title: "Commercial Standards Monthly", short: "CSM" }
end

.typed_stagesObject



19
20
21
# File 'lib/pubid/nist/identifiers/commercial_standards_monthly.rb', line 19

def typed_stages
  TYPED_STAGES
end

Instance Method Details

#publisherObject



28
29
30
# File 'lib/pubid/nist/identifiers/commercial_standards_monthly.rb', line 28

def publisher
  "NBS"
end

#seriesObject



32
33
34
# File 'lib/pubid/nist/identifiers/commercial_standards_monthly.rb', line 32

def series
  "CSM"
end

#to_sObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/pubid/nist/identifiers/commercial_standards_monthly.rb', line 36

def to_s
  result = "#{publisher} #{series}"

  # Proper Volume and Part components
  if volume && part
    result += " #{volume}#{part.to_s(:n_notation)}"
  # Legacy: Code-based number (fallback)
  elsif number
    result += " #{number}"
  # Legacy: Handle old volume+issue_number format
  elsif volume && issue_number
    vol_str = volume.is_a?(Pubid::Nist::Components::Volume) ? volume.to_s : "v#{volume}"
    result += " #{vol_str}n#{issue_number.number}"
  end

  result
end