Class: SolidQueueTui::Application
- Inherits:
-
Object
- Object
- SolidQueueTui::Application
- Defined in:
- lib/solid_queue_tui/application.rb
Constant Summary collapse
- VIEW_DASHBOARD =
0- VIEW_QUEUES =
1- VIEW_FAILED =
2- VIEW_IN_PROGRESS =
3- VIEW_BLOCKED =
4- VIEW_SCHEDULED =
5- VIEW_FINISHED =
6- VIEW_WORKERS =
7- VIEW_COUNT =
8- COMMAND_MAP =
{ "dashboard" => VIEW_DASHBOARD, "queues" => VIEW_QUEUES, "failed" => VIEW_FAILED, "inprogress" => VIEW_IN_PROGRESS, "blocked" => VIEW_BLOCKED, "scheduled" => VIEW_SCHEDULED, "finished" => VIEW_FINISHED, "workers" => VIEW_WORKERS }.freeze
Instance Method Summary collapse
-
#initialize(dev: false) ⇒ Application
constructor
A new instance of Application.
- #run ⇒ Object
Constructor Details
#initialize(dev: false) ⇒ Application
Returns a new instance of Application.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/solid_queue_tui/application.rb', line 30 def initialize(dev: false) @current_view = VIEW_DASHBOARD @last_refresh = Time.at(0) @stats = Data::Stats.empty @show_help = false @command_mode = false @command_input = "" @command_error = nil @dev = dev end |
Instance Method Details
#run ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/solid_queue_tui/application.rb', line 41 def run config = Connection.establish! @refresh_interval = config.fetch("refresh", 2).to_i setup_dev_reloader! if @dev RatatuiRuby.run do |tui| @tui = tui init_views refresh_data! loop do hot_reload! if @dev render event = @tui.poll_event refresh_data_if_needed break if handle_input(event) end end end |