Class: Pubid::Nist::Identifiers::CommercialStandardsMonthly
- 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
- #publisher ⇒ Object
-
#series ⇒ Object
Always the normalized "CSM" code, regardless of the parsed series (CS vNnN variants are routed here and stored with series "CS", but must still render/serialize as CSM).
- #to_s(format = nil) ⇒ Object
Class Method Details
.type ⇒ Object
23 24 25 26 |
# File 'lib/pubid/nist/identifiers/commercial_standards_monthly.rb', line 23 def type { key: :csm, web: :commercial_standards_monthly, title: "Commercial Standards Monthly", short: "CSM" } end |
.typed_stages ⇒ Object
19 20 21 |
# File 'lib/pubid/nist/identifiers/commercial_standards_monthly.rb', line 19 def typed_stages TYPED_STAGES end |
Instance Method Details
#publisher ⇒ Object
29 30 31 |
# File 'lib/pubid/nist/identifiers/commercial_standards_monthly.rb', line 29 def publisher "NBS" end |
#series ⇒ Object
Always the normalized "CSM" code, regardless of the parsed series (CS vNnN variants are routed here and stored with series "CS", but must still render/serialize as CSM). Returns a Components::Code (not a bare String): the lutaml-model key-value serializer reads attributes through this public getter, so a String breaks to_hash for the Code-typed :series attribute.
39 40 41 |
# File 'lib/pubid/nist/identifiers/commercial_standards_monthly.rb', line 39 def series Components::Code.new(value: "CSM") end |
#to_s(format = nil) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/pubid/nist/identifiers/commercial_standards_monthly.rb', line 43 def to_s(format = nil) 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 |