Class: Events::MessageUpdated

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

Overview

Emitted after a Message record is updated and committed. Used by subscribers that need to react to message changes (e.g. broadcasting updated token counts to WebSocket clients).

Constant Summary collapse

TYPE =
"message.updated"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ MessageUpdated

Returns a new instance of MessageUpdated.

Parameters:

  • message (Message)

    the updated message record



13
14
15
# File 'lib/events/message_updated.rb', line 13

def initialize(message)
  @message = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



10
11
12
# File 'lib/events/message_updated.rb', line 10

def message
  @message
end

Instance Method Details

#event_nameObject



17
18
19
# File 'lib/events/message_updated.rb', line 17

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

#to_hObject



21
22
23
# File 'lib/events/message_updated.rb', line 21

def to_h
  {type: TYPE, message:}
end