Class: Pubid::Ccsds::Identifiers::Base
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Pubid::Ccsds::Identifiers::Base
- Includes:
- Serializable
- Defined in:
- lib/pubid/ccsds/identifiers/base.rb,
lib/pubid/ccsds/identifiers/base_BASE_88929.rb
Overview
CCSDS identifier Format: CCSDS NUMBER.PART-TYPE-EDITION Example: CCSDS 120.0-G-4, CCSDS 100.0-G-1-S
Direct Known Subclasses
Constant Summary collapse
- TYPED_STAGES =
CCSDS uses a simple architecture without typed stages TYPED_STAGES includes default stage for base identifiers
[ Pubid::Components::TypedStage.new( abbr: [""], stage_code: "published", type_code: "base", ), ].freeze
Class Method Summary collapse
-
.type ⇒ Hash
Type information for this identifier class.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#base_hash ⇒ Object
Include CCSDS-specific attributes in serialization.
-
#exclude(*args) ⇒ Object
Return a copy of this identifier with the named attributes nil’d.
- #publisher ⇒ Object
- #to_s ⇒ Object
-
#to_urn ⇒ String
Generate URN for this identifier.
Class Method Details
.type ⇒ Hash
Type information for this identifier class
23 24 25 |
# File 'lib/pubid/ccsds/identifiers/base.rb', line 23 def self.type { key: :base, title: "Base Standard", short: nil } end |
Instance Method Details
#==(other) ⇒ Object
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/pubid/ccsds/identifiers/base.rb', line 76 def ==(other) return false unless other.is_a?(Base) number == other.number && part == other.part && type == other.type && edition == other.edition && suffix == other.suffix && language == other.language end |
#base_hash ⇒ Object
Include CCSDS-specific attributes in serialization
43 44 45 46 47 48 49 50 |
# File 'lib/pubid/ccsds/identifiers/base.rb', line 43 def base_hash hash = super # CCSDS uses plain strings for type, edition, suffix hash[:type] = type if type hash[:suffix] = suffix if suffix hash[:language] = language if language hash end |
#exclude(*args) ⇒ Object
Return a copy of this identifier with the named attributes nil’d. Mirrors the Identifier#exclude convenience. CCSDS Base extends Lutaml::Model::Serializable directly (not Pubid::Identifier), so the method is defined here too.
31 32 33 34 35 36 |
# File 'lib/pubid/ccsds/identifiers/base.rb', line 31 def exclude(*args) attrs = self.class.attributes.each_with_object({}) do |(name, _), h| h[name] = args.include?(name) ? nil : send(name) end self.class.new(attrs) end |
#publisher ⇒ Object
59 60 61 |
# File 'lib/pubid/ccsds/identifiers/base.rb', line 59 def publisher "CCSDS" end |
#to_s ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/pubid/ccsds/identifiers/base.rb', line 63 def to_s result = "#{publisher} #{number}" result += ".#{part}" if part result += "-#{type}" if type result += "-#{edition}" if edition result += "-#{suffix}" if suffix # Add language metadata result += " - #{language} Translated" if language result end |
#to_urn ⇒ String
Generate URN for this identifier
19 20 21 |
# File 'lib/pubid/ccsds/identifiers/base_BASE_88929.rb', line 19 def to_urn UrnGenerator.new(self).generate end |