Class: RubynCode::Memory::MemoryRecord
- Inherits:
-
Data
- Object
- Data
- RubynCode::Memory::MemoryRecord
- Defined in:
- lib/rubyn_code/memory/models.rb
Overview
Immutable value object representing a single memory record.
Tiers control retention and decay:
- "short" : ephemeral, decays quickly, session-scoped
- "medium" : moderate retention, project-scoped
- "long" : persistent, rarely decays
Categories classify the kind of knowledge stored:
- "code_pattern" : recurring code patterns or idioms
- "user_preference" : how the user likes things done
- "project_convention" : project-specific conventions
- "error_resolution" : known error/fix pairs
- "decision" : architectural or design decisions
Instance Attribute Summary collapse
-
#access_count ⇒ Object
readonly
Returns the value of attribute access_count.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_accessed_at ⇒ Object
readonly
Returns the value of attribute last_accessed_at.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
-
#relevance_score ⇒ Object
readonly
Returns the value of attribute relevance_score.
-
#tier ⇒ Object
readonly
Returns the value of attribute tier.
Instance Method Summary collapse
Instance Attribute Details
#access_count ⇒ Object (readonly)
Returns the value of attribute access_count
21 22 23 |
# File 'lib/rubyn_code/memory/models.rb', line 21 def access_count @access_count end |
#category ⇒ Object (readonly)
Returns the value of attribute category
21 22 23 |
# File 'lib/rubyn_code/memory/models.rb', line 21 def category @category end |
#content ⇒ Object (readonly)
Returns the value of attribute content
21 22 23 |
# File 'lib/rubyn_code/memory/models.rb', line 21 def content @content end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at
21 22 23 |
# File 'lib/rubyn_code/memory/models.rb', line 21 def created_at @created_at end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at
21 22 23 |
# File 'lib/rubyn_code/memory/models.rb', line 21 def expires_at @expires_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id
21 22 23 |
# File 'lib/rubyn_code/memory/models.rb', line 21 def id @id end |
#last_accessed_at ⇒ Object (readonly)
Returns the value of attribute last_accessed_at
21 22 23 |
# File 'lib/rubyn_code/memory/models.rb', line 21 def last_accessed_at @last_accessed_at end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
21 22 23 |
# File 'lib/rubyn_code/memory/models.rb', line 21 def @metadata end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path
21 22 23 |
# File 'lib/rubyn_code/memory/models.rb', line 21 def project_path @project_path end |
#relevance_score ⇒ Object (readonly)
Returns the value of attribute relevance_score
21 22 23 |
# File 'lib/rubyn_code/memory/models.rb', line 21 def relevance_score @relevance_score end |
#tier ⇒ Object (readonly)
Returns the value of attribute tier
21 22 23 |
# File 'lib/rubyn_code/memory/models.rb', line 21 def tier @tier end |
Instance Method Details
#expired? ⇒ Boolean
27 28 29 30 31 32 33 |
# File 'lib/rubyn_code/memory/models.rb', line 27 def expired? return false if expires_at.nil? Time.parse(expires_at.to_s) < Time.now rescue ArgumentError false end |
#long? ⇒ Boolean
42 |
# File 'lib/rubyn_code/memory/models.rb', line 42 def long? = tier == 'long' |
#medium? ⇒ Boolean
39 |
# File 'lib/rubyn_code/memory/models.rb', line 39 def medium? = tier == 'medium' |
#short? ⇒ Boolean
36 |
# File 'lib/rubyn_code/memory/models.rb', line 36 def short? = tier == 'short' |
#to_h ⇒ Hash
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rubyn_code/memory/models.rb', line 45 def to_h { id: id, project_path: project_path, tier: tier, category: category, content: content, relevance_score: relevance_score, access_count: access_count, last_accessed_at: last_accessed_at, expires_at: expires_at, metadata: , created_at: created_at } end |