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 event classes inherit from ‘BaseEvent`, which provides common properties shared across all event types. Value types in this module (RunFinishedSuccessOutcome, RunFinishedInterruptOutcome) inherit directly from `Model` — they are payload types referenced by events, not events themselves. “`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.



109
110
111
112
113
# File 'lib/ag_ui_protocol/core/events.rb', line 109

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.



103
104
105
# File 'lib/ag_ui_protocol/core/events.rb', line 103

def raw_event
  @raw_event
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



100
101
102
# File 'lib/ag_ui_protocol/core/events.rb', line 100

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



97
98
99
# File 'lib/ag_ui_protocol/core/events.rb', line 97

def type
  @type
end

Instance Method Details

#to_hObject



116
117
118
119
120
121
122
# File 'lib/ag_ui_protocol/core/events.rb', line 116

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