Class: ClaudeMemory::Domain::Fact
- Inherits:
-
Object
- Object
- ClaudeMemory::Domain::Fact
- Defined in:
- lib/claude_memory/domain/fact.rb
Overview
Domain model representing a fact in the memory system. Encapsulates business logic and validation. Instances are immutable (frozen).
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#docid ⇒ Object
readonly
Returns the value of attribute docid.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#object_literal ⇒ Object
readonly
Returns the value of attribute object_literal.
-
#predicate ⇒ Object
readonly
Returns the value of attribute predicate.
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#subject_name ⇒ Object
readonly
Returns the value of attribute subject_name.
-
#valid_from ⇒ Object
readonly
Returns the value of attribute valid_from.
-
#valid_to ⇒ Object
readonly
Returns the value of attribute valid_to.
Instance Method Summary collapse
-
#active? ⇒ Boolean
True when status is “active”.
-
#global? ⇒ Boolean
True when scope is “global”.
-
#initialize(attributes) ⇒ Fact
constructor
A new instance of Fact.
-
#project? ⇒ Boolean
True when scope is “project”.
-
#rejected? ⇒ Boolean
True when status is “rejected”.
-
#superseded? ⇒ Boolean
True when status is “superseded”.
-
#to_h ⇒ Hash
All attributes as a plain hash.
Constructor Details
#initialize(attributes) ⇒ Fact
Returns a new instance of Fact.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/claude_memory/domain/fact.rb', line 26 def initialize(attributes) @id = attributes[:id] @docid = attributes[:docid] @subject_name = attributes[:subject_name] @predicate = attributes[:predicate] @object_literal = attributes[:object_literal] @status = attributes[:status] || "active" @confidence = attributes[:confidence] || 1.0 @scope = attributes[:scope] || "project" @project_path = attributes[:project_path] @valid_from = attributes[:valid_from] @valid_to = attributes[:valid_to] @created_at = attributes[:created_at] validate! freeze end |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def confidence @confidence end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def created_at @created_at end |
#docid ⇒ Object (readonly)
Returns the value of attribute docid.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def docid @docid end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def id @id end |
#object_literal ⇒ Object (readonly)
Returns the value of attribute object_literal.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def object_literal @object_literal end |
#predicate ⇒ Object (readonly)
Returns the value of attribute predicate.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def predicate @predicate end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def project_path @project_path end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def scope @scope end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def status @status end |
#subject_name ⇒ Object (readonly)
Returns the value of attribute subject_name.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def subject_name @subject_name end |
#valid_from ⇒ Object (readonly)
Returns the value of attribute valid_from.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def valid_from @valid_from end |
#valid_to ⇒ Object (readonly)
Returns the value of attribute valid_to.
8 9 10 |
# File 'lib/claude_memory/domain/fact.rb', line 8 def valid_to @valid_to end |
Instance Method Details
#active? ⇒ Boolean
Returns true when status is “active”.
45 46 47 |
# File 'lib/claude_memory/domain/fact.rb', line 45 def active? status == "active" end |
#global? ⇒ Boolean
Returns true when scope is “global”.
60 61 62 |
# File 'lib/claude_memory/domain/fact.rb', line 60 def global? scope == "global" end |
#project? ⇒ Boolean
Returns true when scope is “project”.
65 66 67 |
# File 'lib/claude_memory/domain/fact.rb', line 65 def project? scope == "project" end |
#rejected? ⇒ Boolean
Returns true when status is “rejected”.
55 56 57 |
# File 'lib/claude_memory/domain/fact.rb', line 55 def rejected? status == "rejected" end |
#superseded? ⇒ Boolean
Returns true when status is “superseded”.
50 51 52 |
# File 'lib/claude_memory/domain/fact.rb', line 50 def superseded? status == "superseded" end |
#to_h ⇒ Hash
Returns all attributes as a plain hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/claude_memory/domain/fact.rb', line 70 def to_h { id: id, docid: docid, subject_name: subject_name, predicate: predicate, object_literal: object_literal, status: status, confidence: confidence, scope: scope, project_path: project_path, valid_from: valid_from, valid_to: valid_to, created_at: created_at } end |