Class: AgUiProtocol::Core::Events::CustomEvent

Inherits:
BaseEvent show all
Defined in:
lib/ag_ui_protocol/core/events.rb

Overview

Used for application-specific custom events.

“‘ruby event = AgUiProtocol::Core::Events::CustomEvent.new(name: “my_event”, value: { “a” => 1 }) “`

Instance Attribute Summary collapse

Attributes inherited from BaseEvent

#raw_event, #timestamp, #type

Instance Method Summary collapse

Methods inherited from Types::Model

#as_json, #to_json

Constructor Details

#initialize(name:, value:, timestamp: nil, raw_event: nil) ⇒ CustomEvent

Returns a new instance of CustomEvent.



815
816
817
818
819
# File 'lib/ag_ui_protocol/core/events.rb', line 815

def initialize(name:, value:, timestamp: nil, raw_event: nil)
  super(type: EventType::CUSTOM, timestamp: timestamp, raw_event: raw_event)
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



805
806
807
# File 'lib/ag_ui_protocol/core/events.rb', line 805

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



808
809
810
# File 'lib/ag_ui_protocol/core/events.rb', line 808

def value
  @value
end

Instance Method Details

#to_hObject



822
823
824
# File 'lib/ag_ui_protocol/core/events.rb', line 822

def to_h
  super.merge(name: @name, value: @value)
end