Class: Pubid::Nist::SupplementIdentifier
- Inherits:
-
Identifiers::Base
- Object
- Lutaml::Model::Serializable
- Identifier
- Identifiers::Base
- Pubid::Nist::SupplementIdentifier
- Defined in:
- lib/pubid/nist/supplement_identifier.rb
Overview
Base class for NIST supplement identifiers Supplements wrap a base identifier with additional edition information
Architecture follows ISO pattern:
-
base_identifier: The base document being supplemented
-
edition: Edition information for the supplement
Examples:
-
“NBS CIRC 101e2supp” → CircularSupplement(base: “NBS CIRC 101”, edition: e2)
-
“NBS CIRC 25supp-1924” → CircularSupplement(base: “NBS CIRC 25”, edition: 1924)
Direct Known Subclasses
Constant Summary
Constants inherited from Identifiers::Base
Identifiers::Base::EQUALITY_IGNORED_ATTRS
Instance Method Summary collapse
-
#publisher ⇒ Object
Delegate publisher to base_identifier.
-
#series ⇒ Object
Delegate series to base_identifier.
- #to_s(format = :short) ⇒ Object
Methods inherited from Identifiers::Base
#==, #edition_greater?, #exclude, #extract_edition_number, #hash, #initialize, #language, #matches?, #merge, #revision, #series_code, #supplement_short, #translation, typed_stages, #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, #year
Constructor Details
This class inherits a constructor from Pubid::Nist::Identifiers::Base
Instance Method Details
#publisher ⇒ Object
Delegate publisher to base_identifier
19 20 21 |
# File 'lib/pubid/nist/supplement_identifier.rb', line 19 def publisher base_identifier&.publisher end |
#series ⇒ Object
Delegate series to base_identifier
24 25 26 |
# File 'lib/pubid/nist/supplement_identifier.rb', line 24 def series base_identifier&.series end |
#to_s(format = :short) ⇒ Object
28 29 30 31 32 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 |
# File 'lib/pubid/nist/supplement_identifier.rb', line 28 def to_s(format = :short) # Handle date range supplements (no base identifier) if supplement_date_range_start && supplement_date_range_end return "NBS CIRC sup#{supplement_date_range_start}-#{supplement_date_range_end}" end return super unless base_identifier result = base_identifier.to_s(format) # NEW: Handle update attribute (e.g., "Upd12-1926" for supplement patterns) if update # Implicit supplements (e.g. "145r11/1925") have no explicit marker; # everything else uses the canonical single-p "sup" marker # (relaton-data-nist uses "sup" across all series). is_implicit = self.class.attributes.key?(:implicit_supplement) && implicit_supplement == true result += "sup" unless is_implicit result += "/#{update}" return result end # Canonical supplement marker is single-p "sup" across all NIST/NBS # series (relaton-data-nist: SP/CIRC/HB/RPT/LC/IR/MONO/BMS all use "sup"). result += "sup" # Add edition information if present (just ID, not type prefix) if edition&.id # Smart dash logic: month=no dash, year=dash result += if edition.id.match?(/^[A-Z]/) edition.id else "-#{edition.id}" end end result end |