module RatatuiRuby
The RatatuiRuby module acts as a namespace for the entire gem. It provides the main entry points for initializing the terminal and drawing the UI.
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com> SPDX-License-Identifier: AGPL-3.0-or-later
Constants
- VERSION
-
The version of the ratatui_ruby gem. See semver.org/spec/v2.0.0.html
Public Class Methods
Source
# File lib/ratatui_ruby.rb, line 100 def self.main_loop require_relative "ratatui_ruby/dsl" init_terminal loop do yield DSL.new end ensure restore_terminal end
Provides a convenience wrapper for the main TUI loop. Initializes the terminal, runs the loop, and ensures the terminal is restored.
RatatuiRuby.main_loop do draw RatatuiRuby::Paragraph.new(text: "Hello") event = RatatuiRuby::poll_event break if event && event[:type] == :key && event[:code] == "q" end
Public Instance Methods
Source
# File lib/ratatui_ruby.rb, line 60
Source
# File lib/ratatui_ruby.rb, line 42
Initializes the terminal for TUI mode. Enters alternate screen and enables raw mode.
(Native method implemented in Rust)
Source
# File lib/ratatui_ruby.rb, line 80
Injects a mock event into the event queue for testing purposes.
- event_type
-
“key” or “mouse”
- data
-
a Hash containing event data
inject_test_event("key", { code: "a" })
(Native method implemented in Rust)
Source
# File lib/ratatui_ruby.rb, line 69
Polls for a keyboard event.
poll_event # => { type: :key, code: "a", modifiers: ["ctrl"] }
(Native method implemented in Rust)
Source
# File lib/ratatui_ruby.rb, line 51
Restores the terminal to its original state. Leaves alternate screen and disables raw mode.
(Native method implemented in Rust)