Class: Cadenya::Types::MemoryEntrySpec

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(key: nil, description: nil) ⇒ MemoryEntrySpec

Returns a new instance of MemoryEntrySpec.



3144
3145
3146
3147
# File 'lib/cadenya/types.rb', line 3144

def initialize(key: nil, description: nil)
  @key = key
  @description = description
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



3142
3143
3144
# File 'lib/cadenya/types.rb', line 3142

def description
  @description
end

#keyObject (readonly)

Returns the value of attribute key.



3142
3143
3144
# File 'lib/cadenya/types.rb', line 3142

def key
  @key
end

Class Method Details

.from_json(data) ⇒ Object



3149
3150
3151
3152
3153
3154
# File 'lib/cadenya/types.rb', line 3149

def self.from_json(data)
  new(
    key: data["key"],
    description: data["description"],
  )
end

Instance Method Details

#to_hObject



3156
3157
3158
3159
3160
3161
# File 'lib/cadenya/types.rb', line 3156

def to_h
  {
    key: Util.plain(@key),
    description: Util.plain(@description),
  }.reject { |_k, v| v.nil? }
end