Class: Events::GoalCreated

Inherits:
Object
  • Object
show all
Defined in:
lib/events/goal_created.rb

Overview

Emitted after a Goal record is committed for the first time. The drain pipeline’s MeleteEnrichmentJob subscribes for the duration of one Melete run so a fresh goal triggers Mneme recall against the updated goal set before the user’s message reaches the LLM.

Constant Summary collapse

TYPE =
"goal.created"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session_id:, goal_id:) ⇒ GoalCreated

Returns a new instance of GoalCreated.

Parameters:

  • session_id (Integer)

    session that owns the goal

  • goal_id (Integer)

    the newly created goal



15
16
17
18
# File 'lib/events/goal_created.rb', line 15

def initialize(session_id:, goal_id:)
  @session_id = session_id
  @goal_id = goal_id
end

Instance Attribute Details

#goal_idObject (readonly)

Returns the value of attribute goal_id.



11
12
13
# File 'lib/events/goal_created.rb', line 11

def goal_id
  @goal_id
end

#session_idObject (readonly)

Returns the value of attribute session_id.



11
12
13
# File 'lib/events/goal_created.rb', line 11

def session_id
  @session_id
end

Instance Method Details

#event_nameObject



20
21
22
# File 'lib/events/goal_created.rb', line 20

def event_name
  "#{Bus::NAMESPACE}.#{TYPE}"
end

#to_hObject



24
25
26
# File 'lib/events/goal_created.rb', line 24

def to_h
  {type: TYPE, session_id:, goal_id:}
end