Class: Pubid::Ccsds::Identifier
- Inherits:
-
Identifier
- Object
- Lutaml::Model::Serializable
- Identifier
- Pubid::Ccsds::Identifier
- Defined in:
- lib/pubid/ccsds/identifier.rb
Overview
Abstract root for every CCSDS identifier AND the flavor's parse entry
point — mirrors Pubid::Iso::Identifier / Pubid::Jis::Identifier. Concrete
identifiers (Identifiers::Base, Identifiers::Corrigendum) descend from this
class, so a parsed CCSDS id is an instance of Pubid::Ccsds::Identifier and
relaton-index can pass this class as pubid_class for from_hash/to_hash.
Keeping the root abstract (it is never itself a serialized type, so it is
absent from CCSDS_TYPE_MAP) is what breaks the polymorphic recursion a
supplement's base_identifier would otherwise hit if it pointed at a
concrete type that is also its own superclass.
Direct Known Subclasses
Constant Summary collapse
- CCSDS_TYPE_MAP =
Polymorphic type map for lutaml::Model key_value (de)serialization, mapping each concrete class's polymorphic_name to its class name.
{ "pubid:ccsds:base" => "Pubid::Ccsds::Identifiers::Base", "pubid:ccsds:corrigendum" => "Pubid::Ccsds::Identifiers::Corrigendum", }.freeze
Class Method Summary collapse
-
.parse(identifier) ⇒ Object
Parse a CCSDS identifier string into the appropriate identifier object.
Instance Method Summary collapse
Methods inherited from Identifier
#base_identifier, #eql?, #exclude, from_hash, #hash, #initialize, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, polymorphic_type_map, #render, #resolve_urn_generator, #root, #to_hash, #to_mr_string, #to_s, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code, #year
Constructor Details
This class inherits a constructor from Pubid::Identifier
Class Method Details
.parse(identifier) ⇒ Object
Parse a CCSDS identifier string into the appropriate identifier object.
56 57 58 59 60 61 62 63 |
# File 'lib/pubid/ccsds/identifier.rb', line 56 def self.parse(identifier) # Apply legacy update_codes normalization first normalized = Core::UpdateCodes.apply(identifier, :ccsds) parsed = Pubid::Ccsds::Parser.parse(normalized) Pubid::Ccsds::Builder.build(parsed) rescue Parslet::ParseFailed => e raise "Failed to parse CCSDS identifier '#{identifier}': #{e.}" end |
Instance Method Details
#publisher ⇒ Object
51 52 53 |
# File 'lib/pubid/ccsds/identifier.rb', line 51 def publisher "CCSDS" end |