Class: SimpleAcp::Models::Event Abstract

Inherits:
Base
  • Object
show all
Defined in:
lib/simple_acp/models/events.rb

Overview

This class is abstract.

Subclass and set type in initializer

Base class for all Server-Sent Events (SSE).

Events are streamed during run execution to provide real-time updates on progress and output.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, attribute, attributes, from_hash, #hash, #initialize, own_attributes, #to_h, #to_json

Constructor Details

This class inherits a constructor from SimpleAcp::Models::Base

Instance Attribute Details

#type ⇒ String (readonly)

Returns event type (see Types::EventType).

Returns:

  • (String) —

    event type (see Types::EventType)



14
# File 'lib/simple_acp/models/events.rb', line 14

attribute :type, required: true

Instance Method Details

#sse_format ⇒ String

Format for Server-Sent Events protocol.

Returns:

  • (String) —

    SSE-formatted event



19
20
21
# File 'lib/simple_acp/models/events.rb', line 19

def sse_format
  "event: #{@type}\ndata: #{to_json}\n\n"
end