$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
require "ratatui_ruby"
require "rooibos"
class VerifyReadmeUsage
Model = Data.define(:text)
Init = -> do
Model.new(text: "Hello, Ratatui! Press 'q' to quit.")
end
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?
Rooibos::Command.exit
else
model
end
end
def run
Rooibos.run(VerifyReadmeUsage)
end
end
VerifyReadmeUsage.new.run if __FILE__ == $PROGRAM_NAME