Module: Sidekiq::Pauzer::Patches::WebAction

Defined in:
lib/sidekiq/pauzer/patches/web_action.rb

Constant Summary collapse

PAUZER_QUEUES_TEMPLATE =
ERB.new(File.read(File.expand_path("../../../../web/views/queues.erb", __dir__))).src

Class Method Summary collapse

Class Method Details

.apply!Object



17
18
19
20
21
22
23
24
25
# File 'lib/sidekiq/pauzer/patches/web_action.rb', line 17

def apply!
  revert!

  Sidekiq::WebAction.class_eval <<-RUBY, __FILE__, __LINE__ + 1 # rubocop:disable Style/DocumentDynamicEvalDefinition
    def _erb_queues
      #{PAUZER_QUEUES_TEMPLATE}
    end
  RUBY
end

.revert!Object



27
28
29
# File 'lib/sidekiq/pauzer/patches/web_action.rb', line 27

def revert!
  Sidekiq::WebAction.remove_method(:_erb_queues) if Sidekiq::WebAction.method_defined?(:_erb_queues)
end