Class: Legion::Extensions::Agentic::Social::Mirror::Helpers::MirrorEvent
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Social::Mirror::Helpers::MirrorEvent
- Defined in:
- lib/legion/extensions/agentic/social/mirror/helpers/mirror_event.rb
Instance Attribute Summary collapse
-
#action_type ⇒ Object
readonly
Returns the value of attribute action_type.
-
#agent_id ⇒ Object
readonly
Returns the value of attribute agent_id.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#emotional_valence ⇒ Object
readonly
Returns the value of attribute emotional_valence.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#observed_at ⇒ Object
readonly
Returns the value of attribute observed_at.
Instance Method Summary collapse
-
#initialize(agent_id:, action_type:, context: {}, emotional_valence: 0.0) ⇒ MirrorEvent
constructor
A new instance of MirrorEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(agent_id:, action_type:, context: {}, emotional_valence: 0.0) ⇒ MirrorEvent
Returns a new instance of MirrorEvent.
14 15 16 17 18 19 20 21 |
# File 'lib/legion/extensions/agentic/social/mirror/helpers/mirror_event.rb', line 14 def initialize(agent_id:, action_type:, context: {}, emotional_valence: 0.0) @id = SecureRandom.uuid @agent_id = agent_id @action_type = normalize_action_type(action_type) @context = context.is_a?(Hash) ? context : {} @emotional_valence = emotional_valence.to_f.clamp(-1.0, 1.0) @observed_at = Time.now.utc end |
Instance Attribute Details
#action_type ⇒ Object (readonly)
Returns the value of attribute action_type.
12 13 14 |
# File 'lib/legion/extensions/agentic/social/mirror/helpers/mirror_event.rb', line 12 def action_type @action_type end |
#agent_id ⇒ Object (readonly)
Returns the value of attribute agent_id.
12 13 14 |
# File 'lib/legion/extensions/agentic/social/mirror/helpers/mirror_event.rb', line 12 def agent_id @agent_id end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
12 13 14 |
# File 'lib/legion/extensions/agentic/social/mirror/helpers/mirror_event.rb', line 12 def context @context end |
#emotional_valence ⇒ Object (readonly)
Returns the value of attribute emotional_valence.
12 13 14 |
# File 'lib/legion/extensions/agentic/social/mirror/helpers/mirror_event.rb', line 12 def emotional_valence @emotional_valence end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/social/mirror/helpers/mirror_event.rb', line 12 def id @id end |
#observed_at ⇒ Object (readonly)
Returns the value of attribute observed_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/social/mirror/helpers/mirror_event.rb', line 12 def observed_at @observed_at end |
Instance Method Details
#to_h ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/legion/extensions/agentic/social/mirror/helpers/mirror_event.rb', line 23 def to_h { id: @id, agent_id: @agent_id, action_type: @action_type, context: @context, emotional_valence: @emotional_valence, observed_at: @observed_at } end |