Class: AgUiProtocol::Core::Events::BaseEvent

Inherits:
Types::Model show all
Extended by:
T::Sig
Defined in:
lib/ag_ui_protocol/core/events.rb

Overview

All events inherit from the ‘BaseEvent` class, which provides common properties shared across all event types. “`ruby

event = AgUiProtocol::Core::Events::BaseEvent.new(

type: AgUiProtocol::Core::Events::EventType::RAW,
timestamp: nil,
raw_event: nil

)

“‘

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Types::Model

#as_json, #to_json

Constructor Details

#initialize(type:, timestamp: nil, raw_event: nil) ⇒ BaseEvent

Returns a new instance of BaseEvent.



90
91
92
93
94
# File 'lib/ag_ui_protocol/core/events.rb', line 90

def initialize(type:, timestamp: nil, raw_event: nil)
  @type = type
  @timestamp = timestamp
  @raw_event = raw_event
end

Instance Attribute Details

#raw_eventObject (readonly)

Returns the value of attribute raw_event.



84
85
86
# File 'lib/ag_ui_protocol/core/events.rb', line 84

def raw_event
  @raw_event
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



81
82
83
# File 'lib/ag_ui_protocol/core/events.rb', line 81

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



78
79
80
# File 'lib/ag_ui_protocol/core/events.rb', line 78

def type
  @type
end

Instance Method Details

#to_hObject



97
98
99
100
101
102
103
# File 'lib/ag_ui_protocol/core/events.rb', line 97

def to_h
  {
    type: @type,
    timestamp: @timestamp,
    raw_event: @raw_event
  }
end