Class: Llmemory::LongTerm::FileBased::Resource
- Inherits:
-
Object
- Object
- Llmemory::LongTerm::FileBased::Resource
- Defined in:
- lib/llmemory/long_term/file_based/resource.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#initialize(id:, user_id:, text:, created_at: nil) ⇒ Resource
constructor
A new instance of Resource.
- #to_h ⇒ Object
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_at ⇒ Object (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 |
#id ⇒ Object (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 |
#text ⇒ Object (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_id ⇒ Object (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_h ⇒ Object
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 |