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
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 98 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 58
Source
# File lib/ratatui_ruby.rb, line 40
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 78
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 67
Polls for a keyboard event.
poll_event # => { type: "key", code: "char", value: "a", modifiers: [] }
(Native method implemented in Rust)
Source
# File lib/ratatui_ruby.rb, line 49
Restores the terminal to its original state. Leaves alternate screen and disables raw mode.
(Native method implemented in Rust)