class Riffer::StreamEvents::Interrupt
Represents an interrupt event during streaming.
Emitted when a callback interrupts the agent loop via +throw :riffer_interrupt+.
Attributes
The reason provided with the interrupt, if any.
Public Class Methods
Source
# File lib/riffer/stream_events/interrupt.rb, line 12 def initialize(reason: nil) super(role: :system) @reason = reason end
: (?reason: (String | Symbol)?) -> void
Calls superclass method
Riffer::StreamEvents::Base::new
Public Instance Methods
Source
# File lib/riffer/stream_events/interrupt.rb, line 20 def to_h h = {role: @role, interrupt: true} h[:reason] = @reason if @reason h end
Converts the event to a hash.
: () -> Hash[Symbol, untyped]