README Usage Verification
Verifies the primary usage example for the Tea gem.
This example exists as a documentation regression test. It ensures that the very first MVU pattern a user sees actually works.
Usage
Model = Data.define(:text) MODEL = Model.new(text: "Hello, Ratatui! Press 'q' to quit.") VIEW = -> (model, tui) do tui.paragraph( text: model.text, alignment: :center, block: tui.block( title: "My Ruby TUI App", borders: [:all], border_style: { fg: "cyan" } ) ) end UPDATE = -> (msg, model) do if msg.q? || msg.ctrl_c? RatatuiRuby::Tea::Command.exit else model end end def run RatatuiRuby::Tea.run(model: MODEL, view: VIEW, update: UPDATE) end
