Class: Pubid::Ccsds::Identifiers::Base

Inherits:
Lutaml::Model::Serializable
  • Object
show all
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

SupplementIdentifier

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

Instance Method Summary collapse

Class Method Details

.typeHash

Type information for this identifier class

Returns:

  • (Hash)

    Type information with key, title, and short form



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



65
66
67
68
69
70
71
72
73
74
# File 'lib/pubid/ccsds/identifiers/base.rb', line 65

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_hashObject

Include CCSDS-specific attributes in serialization



32
33
34
35
36
37
38
39
# File 'lib/pubid/ccsds/identifiers/base.rb', line 32

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

#publisherObject



48
49
50
# File 'lib/pubid/ccsds/identifiers/base.rb', line 48

def publisher
  "CCSDS"
end

#to_sObject



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/pubid/ccsds/identifiers/base.rb', line 52

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_urnString

Generate URN for this identifier

Returns:

  • (String)

    URN representation



19
20
21
# File 'lib/pubid/ccsds/identifiers/base_BASE_88929.rb', line 19

def to_urn
  UrnGenerator.new(self).generate
end