Class: Llmemory::LongTerm::FileBased::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/llmemory/long_term/file_based/item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, user_id:, category:, content:, source_resource_id: nil, provenance: nil, created_at: nil) ⇒ Item

Returns a new instance of Item.



9
10
11
12
13
14
15
16
17
# File 'lib/llmemory/long_term/file_based/item.rb', line 9

def initialize(id:, user_id:, category:, content:, source_resource_id: nil, provenance: nil, created_at: nil)
  @id = id
  @user_id = user_id
  @category = category
  @content = content
  @source_resource_id = source_resource_id
  @provenance = provenance
  @created_at = created_at || Time.now
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



7
8
9
# File 'lib/llmemory/long_term/file_based/item.rb', line 7

def category
  @category
end

#contentObject (readonly)

Returns the value of attribute content.



7
8
9
# File 'lib/llmemory/long_term/file_based/item.rb', line 7

def content
  @content
end

#created_atObject (readonly)

Returns the value of attribute created_at.



7
8
9
# File 'lib/llmemory/long_term/file_based/item.rb', line 7

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/llmemory/long_term/file_based/item.rb', line 7

def id
  @id
end

#provenanceObject (readonly)

Returns the value of attribute provenance.



7
8
9
# File 'lib/llmemory/long_term/file_based/item.rb', line 7

def provenance
  @provenance
end

#source_resource_idObject (readonly)

Returns the value of attribute source_resource_id.



7
8
9
# File 'lib/llmemory/long_term/file_based/item.rb', line 7

def source_resource_id
  @source_resource_id
end

#user_idObject (readonly)

Returns the value of attribute user_id.



7
8
9
# File 'lib/llmemory/long_term/file_based/item.rb', line 7

def user_id
  @user_id
end

Instance Method Details

#to_hObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/llmemory/long_term/file_based/item.rb', line 19

def to_h
  {
    id: id,
    user_id: user_id,
    category: category,
    content: content,
    source_resource_id: source_resource_id,
    provenance: provenance,
    created_at: created_at.iso8601
  }
end