Class: Legion::Extensions::Agentic::Defense::Dissonance::Helpers::DissonanceEvent
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Defense::Dissonance::Helpers::DissonanceEvent
- Defined in:
- lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb
Instance Attribute Summary collapse
-
#belief_a_id ⇒ Object
readonly
Returns the value of attribute belief_a_id.
-
#belief_b_id ⇒ Object
readonly
Returns the value of attribute belief_b_id.
-
#contradiction_type ⇒ Object
readonly
Returns the value of attribute contradiction_type.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#magnitude ⇒ Object
readonly
Returns the value of attribute magnitude.
-
#resolution_strategy ⇒ Object
readonly
Returns the value of attribute resolution_strategy.
-
#resolved ⇒ Object
readonly
Returns the value of attribute resolved.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(belief_a_id:, belief_b_id:, domain:, magnitude:, contradiction_type: :direct) ⇒ DissonanceEvent
constructor
A new instance of DissonanceEvent.
- #resolve!(strategy) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(belief_a_id:, belief_b_id:, domain:, magnitude:, contradiction_type: :direct) ⇒ DissonanceEvent
Returns a new instance of DissonanceEvent.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 15 def initialize(belief_a_id:, belief_b_id:, domain:, magnitude:, contradiction_type: :direct) @id = SecureRandom.uuid @belief_a_id = belief_a_id @belief_b_id = belief_b_id @domain = domain @magnitude = magnitude.clamp(0.0, 1.0) @contradiction_type = contradiction_type @resolved = false @resolution_strategy = nil @timestamp = Time.now.utc end |
Instance Attribute Details
#belief_a_id ⇒ Object (readonly)
Returns the value of attribute belief_a_id.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 12 def belief_a_id @belief_a_id end |
#belief_b_id ⇒ Object (readonly)
Returns the value of attribute belief_b_id.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 12 def belief_b_id @belief_b_id end |
#contradiction_type ⇒ Object (readonly)
Returns the value of attribute contradiction_type.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 12 def contradiction_type @contradiction_type end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 12 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 12 def id @id end |
#magnitude ⇒ Object (readonly)
Returns the value of attribute magnitude.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 12 def magnitude @magnitude end |
#resolution_strategy ⇒ Object (readonly)
Returns the value of attribute resolution_strategy.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 12 def resolution_strategy @resolution_strategy end |
#resolved ⇒ Object (readonly)
Returns the value of attribute resolved.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 12 def resolved @resolved end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 12 def @timestamp end |
Instance Method Details
#resolve!(strategy) ⇒ Object
27 28 29 30 31 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 27 def resolve!(strategy) @resolved = true @resolution_strategy = strategy self end |
#to_h ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/dissonance_event.rb', line 33 def to_h { id: id, belief_a_id: belief_a_id, belief_b_id: belief_b_id, domain: domain, magnitude: magnitude, contradiction_type: contradiction_type, resolved: resolved, resolution_strategy: resolution_strategy, timestamp: } end |