Class: Cadenya::Types::MemoryEntry

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) ⇒ MemoryEntry

Returns a new instance of MemoryEntry.



3054
3055
3056
3057
3058
# File 'lib/cadenya/types.rb', line 3054

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.



3052
3053
3054
# File 'lib/cadenya/types.rb', line 3052

def info
  @info
end

#metadataObject (readonly)

Returns the value of attribute metadata.



3052
3053
3054
# File 'lib/cadenya/types.rb', line 3052

def 
  @metadata
end

#specObject (readonly)

Returns the value of attribute spec.



3052
3053
3054
# File 'lib/cadenya/types.rb', line 3052

def spec
  @spec
end

Class Method Details

.from_json(data) ⇒ Object



3060
3061
3062
3063
3064
3065
3066
# File 'lib/cadenya/types.rb', line 3060

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

Instance Method Details

#to_hObject



3068
3069
3070
3071
3072
3073
3074
# File 'lib/cadenya/types.rb', line 3068

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