class RatatuiRuby::Tea::Runtime

Runs the Model-View-Update event loop.

Applications need a render loop. You poll events, update state, redraw. Every frame. The boilerplate is tedious and error-prone.

This class handles the loop. You provide the model, view, and update. It handles the rest.

Use it to build applications with predictable state.

Example

RatatuiRuby::Tea.run(
  model: { count: 0 }.freeze,
  view: ->(m, tui) { tui.paragraph(text: m[:count].to_s) },
  update: ->(msg, m) { msg.q? ? [m, Cmd.quit] : [m, nil] }
)