Class: Llmemory::LongTerm::FileBased::Resource

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, user_id:, text:, created_at: nil) ⇒ Resource

Returns a new instance of Resource.



9
10
11
12
13
14
# File 'lib/llmemory/long_term/file_based/resource.rb', line 9

def initialize(id:, user_id:, text:, created_at: nil)
  @id = id
  @user_id = user_id
  @text = text
  @created_at = created_at || Time.now
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



7
8
9
# File 'lib/llmemory/long_term/file_based/resource.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/resource.rb', line 7

def id
  @id
end

#textObject (readonly)

Returns the value of attribute text.



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

def text
  @text
end

#user_idObject (readonly)

Returns the value of attribute user_id.



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

def user_id
  @user_id
end

Instance Method Details

#to_hObject



16
17
18
# File 'lib/llmemory/long_term/file_based/resource.rb', line 16

def to_h
  { id: id, user_id: user_id, text: text, created_at: created_at.iso8601 }
end