class BotConsole::UI
Constants
- REFRESH_INTERVAL
- STATUS_ROWS
Attributes
Public Class Methods
Source
# File lib/bot_console/ui.rb, line 18 def initialize(manager, root:) @manager = manager @root = root @sync_watcher = SyncWatcher.new(root: root) @layout_mode = :horizontal @focus_index = 0 @show_help = false @show_disabled_menu = false @disabled_selection = 0 @running = false end
Public Instance Methods
Source
# File lib/bot_console/ui.rb, line 30 def run raise "bot_console requires a TTY" unless $stdout.tty? Curses.init_screen Curses.start_color Curses.curs_set(0) Curses.noecho Curses.raw init_colors @running = true @manager.start_enabled_bots loop do break unless @running @sync_watcher.apply_pending!(@manager) draw if input_ready? handle_key(Curses.getch) else sleep REFRESH_INTERVAL end end ensure @manager.shutdown_all Curses.close_screen end