class

Opal::Asciicast::Driver

Inherits Opal::Terminal::Driver < Reference < Object

Headless terminal driver that records all screen output directly into an Asciinema v2 recording (.cast) stream. Allows any Opal application, TEA program, form wizard, or interactive UI to be driven and recorded headlessly.

Constructors

new(width : Int32 = 80, height : Int32 = 24, title : String = "Opal Session", writer : Writer | Nil = nil, time_advance : Float64 = 0.05)
Source

Instance methods

event_queue
Source
event_queue=(event_queue : Array(Terminal::KeyEvent | Terminal::MouseEvent | Terminal::ResizeEvent))
Source
flush
Source
in_raw_mode?
Source
inject_event(event : Terminal::KeyEvent | Terminal::MouseEvent | Terminal::ResizeEvent) : self

Injects a keyboard or mouse event into the driver's input stream

Source
inject_key(name : String, char : Char | Nil = nil, ctrl : Bool = false, alt : Bool = false, shift : Bool = false) : self

Convenience helper: injects a keyboard event

Source
inject_mouse(x : Int32, y : Int32, button : Terminal::MouseButton = Terminal::MouseButton::Left, action : Terminal::MouseAction = Terminal::MouseAction::Press) : self

Convenience helper: injects a mouse event

Source
pause(seconds : Float64) : self

Pauses recording timeline

Source
poll_event(timeout_ms : Int32 = 0) : Terminal::KeyEvent | Terminal::MouseEvent | Terminal::ResizeEvent | Nil

Non-blocking or timed check for input/resize events.

Source
raw_mode

Simulates entering raw mode

Source
read_event

Reads the next simulated or injected input event

Source
save(filename : String) : Nil

Saves the recorded session to a .cast file

Source
size

Terminal dimensions from writer header

Source
time_advance
Source
time_advance=(time_advance : Float64)
Source
to_s(io : IO) : Nil

Returns the complete recorded asciicast content

Source
to_s

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.

Source
write(str : String) : Nil

Records an output chunk to the asciicast timeline

Source
writer
Source