Class: Pubid::Nist::Identifiers::CommercialStandardsMonthly
- Inherits:
-
Base
- Object
- Lutaml::Model::Serializable
- Identifier
- Base
- 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
Constants inherited from Base
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
Methods inherited from Base
#==, #append_mr_components, #append_short_components, #default_publisher, #edition_greater?, #exclude, #extract_edition_number, #hash, #initialize, #language, #matches?, #merge, #publisher_abbreviated_name, #publisher_full_name, #render, #revision, #series_abbreviated_name, #series_code, #series_full_name, #supplement_short, #to_abbreviated_style, #to_full_style, #to_mr_style, #to_short_style, #translation, #weight
Methods included from Pubid::Nist::Identifier
Methods included from IdentifierFacade
#from_hash, #polymorphic_type_map
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, #year
Constructor Details
This class inherits a constructor from Pubid::Nist::Identifiers::Base
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 |