Class: Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::NostalgiaEvent
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::NostalgiaEvent
- Defined in:
- lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event.rb
Instance Attribute Summary collapse
-
#effect_on_mood ⇒ Object
readonly
Returns the value of attribute effect_on_mood.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#intensity ⇒ Object
readonly
Returns the value of attribute intensity.
-
#memory_id ⇒ Object
readonly
Returns the value of attribute memory_id.
-
#occurred_at ⇒ Object
readonly
Returns the value of attribute occurred_at.
-
#trigger ⇒ Object
readonly
Returns the value of attribute trigger.
Instance Method Summary collapse
-
#initialize(memory_id:, trigger:, intensity:, effect_on_mood: 0.0) ⇒ NostalgiaEvent
constructor
A new instance of NostalgiaEvent.
- #nostalgia_label ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(memory_id:, trigger:, intensity:, effect_on_mood: 0.0) ⇒ NostalgiaEvent
Returns a new instance of NostalgiaEvent.
14 15 16 17 18 19 20 21 |
# File 'lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event.rb', line 14 def initialize(memory_id:, trigger:, intensity:, effect_on_mood: 0.0) @id = ::SecureRandom.uuid @memory_id = memory_id @trigger = trigger @intensity = intensity.clamp(0.0, 1.0) @effect_on_mood = effect_on_mood.clamp(-1.0, 1.0) @occurred_at = Time.now.utc end |
Instance Attribute Details
#effect_on_mood ⇒ Object (readonly)
Returns the value of attribute effect_on_mood.
12 13 14 |
# File 'lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event.rb', line 12 def effect_on_mood @effect_on_mood end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event.rb', line 12 def id @id end |
#intensity ⇒ Object (readonly)
Returns the value of attribute intensity.
12 13 14 |
# File 'lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event.rb', line 12 def intensity @intensity end |
#memory_id ⇒ Object (readonly)
Returns the value of attribute memory_id.
12 13 14 |
# File 'lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event.rb', line 12 def memory_id @memory_id end |
#occurred_at ⇒ Object (readonly)
Returns the value of attribute occurred_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event.rb', line 12 def occurred_at @occurred_at end |
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
12 13 14 |
# File 'lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event.rb', line 12 def trigger @trigger end |
Instance Method Details
#nostalgia_label ⇒ Object
23 24 25 |
# File 'lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event.rb', line 23 def nostalgia_label Constants.label_for(Constants::NOSTALGIA_LABELS, @intensity) end |
#to_h ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event.rb', line 27 def to_h { id: id, memory_id: memory_id, trigger: trigger, intensity: @intensity, nostalgia_label: nostalgia_label, effect_on_mood: @effect_on_mood, occurred_at: occurred_at } end |