Class: Pubid::Nist::Identifiers::CommercialStandardsMonthly
- Inherits:
-
Pubid::Nist::Identifier
- Object
- Lutaml::Model::Serializable
- Identifier
- Pubid::Nist::Identifier
- 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 Pubid::Nist::Identifier
Pubid::Nist::Identifier::COMPACT_DROP_ATTRS, Pubid::Nist::Identifier::COMPACT_FLAT_CODES, Pubid::Nist::Identifier::COMPACT_FLAT_VALUES, Pubid::Nist::Identifier::EQUALITY_IGNORED_ATTRS
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 Pubid::Nist::Identifier
#==, #append_mr_components, #append_short_components, #default_publisher, #edition_greater?, expand_code, expand_compact_hash, #extract_edition_number, from_hash, #hash, #initialize, #language, #matches?, #merge, parse, #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_hash, #to_mr_string, #to_mr_style, #to_short_style, #to_slug, #translation, #weight
Methods inherited from Identifier
apply_mappings, #base, #base_document, concrete_class_for, #dated_version_of?, #draft_of?, #drop_supplements, #edition_of?, #eql?, #exclude, from_hash, #has_supplement?, #hash, #includes?, #initialize, #matches?, #mr_all_parts, #mr_edition, #mr_languages, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_subpart, #mr_supplement_suffix, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, polymorphic_type_map, #related_to?, #render, #resolve_urn_generator, #root, #sibling_of?, #supplement_of?, #to_hash, #to_mr_string, #to_slug, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code, #year
Constructor Details
This class inherits a constructor from Pubid::Nist::Identifier
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 |