Class: Engram::Decision
- Inherits:
-
Object
- Object
- Engram::Decision
- Defined in:
- lib/engram/decision.rb
Overview
The outcome of consolidating one candidate fact against existing memory.
action - :add | :update | :forget | :noop
candidate - the Record produced by extraction
target_id - id of the existing memory to update/forget (nil for add/noop)
reason - optional human-readable rationale (useful for audit/eval)
Constant Summary collapse
- ACTIONS =
%i[add update forget noop].freeze
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#candidate ⇒ Object
readonly
Returns the value of attribute candidate.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#target_id ⇒ Object
readonly
Returns the value of attribute target_id.
Instance Method Summary collapse
-
#initialize(action:, candidate:, target_id: nil, reason: nil) ⇒ Decision
constructor
A new instance of Decision.
Constructor Details
#initialize(action:, candidate:, target_id: nil, reason: nil) ⇒ Decision
Returns a new instance of Decision.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/engram/decision.rb', line 15 def initialize(action:, candidate:, target_id: nil, reason: nil) action = action.to_sym unless ACTIONS.include?(action) raise ArgumentError, "unknown action #{action.inspect}; expected one of #{ACTIONS.inspect}" end @action = action @candidate = candidate @target_id = target_id @reason = reason end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
13 14 15 |
# File 'lib/engram/decision.rb', line 13 def action @action end |
#candidate ⇒ Object (readonly)
Returns the value of attribute candidate.
13 14 15 |
# File 'lib/engram/decision.rb', line 13 def candidate @candidate end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
13 14 15 |
# File 'lib/engram/decision.rb', line 13 def reason @reason end |
#target_id ⇒ Object (readonly)
Returns the value of attribute target_id.
13 14 15 |
# File 'lib/engram/decision.rb', line 13 def target_id @target_id end |