class SidekiqSpy::Display::Panels::Queues

Public Class Methods

new(height, width, top, left) click to toggle source
Calls superclass method SidekiqSpy::Display::Panel::new
# File lib/sidekiq-spy/display/panels/queues.rb, line 6
def initialize(height, width, top, left)
  super(height, width, top, left, structure(height), :divider_r => " ")
  
  @spies[:queues] = Spy::Queues.new
end

Public Instance Methods

structure(height) click to toggle source
# File lib/sidekiq-spy/display/panels/queues.rb, line 12
def structure(height)
  # [
  #   [relative_column_width, data_left, data_right]
  # ]
  s = [
    [ # table header slots
      [2, t[:heading][:queue],  nil],
      [1, nil,                  t[:heading][:size]],
    ],
  ]
  
  (0...(height - 1)).each do |i|
    s << [ # table row slots
      [2, -> { @spies[:queues][i][:name] }, nil],
      [1, nil,                              -> { @spies[:queues][i][:size] }],
    ]
  end
  
  s
end