Class: Cadenya::Types::MemoryLayer

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata: nil, spec: nil, info: nil) ⇒ MemoryLayer

Returns a new instance of MemoryLayer.



3196
3197
3198
3199
3200
# File 'lib/cadenya/types.rb', line 3196

def initialize(metadata: nil, spec: nil, info: nil)
  @metadata = 
  @spec = spec
  @info = info
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



3194
3195
3196
# File 'lib/cadenya/types.rb', line 3194

def info
  @info
end

#metadataObject (readonly)

Returns the value of attribute metadata.



3194
3195
3196
# File 'lib/cadenya/types.rb', line 3194

def 
  @metadata
end

#specObject (readonly)

Returns the value of attribute spec.



3194
3195
3196
# File 'lib/cadenya/types.rb', line 3194

def spec
  @spec
end

Class Method Details

.from_json(data) ⇒ Object



3202
3203
3204
3205
3206
3207
3208
# File 'lib/cadenya/types.rb', line 3202

def self.from_json(data)
  new(
    metadata: data["metadata"].nil? ? nil : Types::ResourceMetadata.from_json(data["metadata"]),
    spec: data["spec"].nil? ? nil : Types::MemoryLayerSpec.from_json(data["spec"]),
    info: data["info"].nil? ? nil : Types::MemoryLayerInfo.from_json(data["info"]),
  )
end

Instance Method Details

#to_hObject



3210
3211
3212
3213
3214
3215
3216
# File 'lib/cadenya/types.rb', line 3210

def to_h
  {
    metadata: Util.plain(@metadata),
    spec: Util.plain(@spec),
    info: Util.plain(@info),
  }.reject { |_k, v| v.nil? }
end