Class: Capsium::Package::StorageConfig

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/capsium/package/storage_config.rb,
sig/capsium/package/storage_config.rbs

Overview

Canonical storage.json model. The legacy array form is normalized on read; writers emit only the canonical form.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStorageConfig

Returns a new instance of StorageConfig.

Parameters:



71
# File 'sig/capsium/package/storage_config.rbs', line 71

def initialize: (?storage: StorageData? storage) -> void

Instance Attribute Details

#storageStorageData?

Returns the value of attribute storage.

Returns:



69
70
71
# File 'sig/capsium/package/storage_config.rbs', line 69

def storage
  @storage
end

Class Method Details

.from_json(json) ⇒ instance

Parameters:

  • json (String)

Returns:

  • (instance)


105
106
107
108
109
# File 'lib/capsium/package/storage_config.rb', line 105

def self.from_json(json)
  doc = JSON.parse(json)
  doc["storage"] ||= { "dataSets" => legacy_data_sets(doc.delete("datasets")) }
  super(JSON.generate(doc))
end

Instance Method Details

#data_setsHash[String, DatasetConfig]

Returns:



123
124
125
# File 'lib/capsium/package/storage_config.rb', line 123

def data_sets
  storage ? storage.data_sets : {}
end

#layersArray[LayerConfig]

The configured storage layers, bottom -> top (empty when the package uses the single implicit content/ layer).

Returns:



129
130
131
# File 'lib/capsium/package/storage_config.rb', line 129

def layers
  storage ? storage.layers : []
end

#to_hashHash[String, untyped]

Returns:

  • (Hash[String, untyped])


82
# File 'sig/capsium/package/storage_config.rbs', line 82

def to_hash: () -> Hash[String, untyped]

#to_jsonString

Parameters:

  • args (Object)

Returns:

  • (String)


81
# File 'sig/capsium/package/storage_config.rbs', line 81

def to_json: (*untyped args) -> String