Module: Sidekiq::Throttled::Web::SummaryFix

Defined in:
lib/sidekiq/throttled/web/summary_fix.rb

Constant Summary collapse

JAVASCRIPT =
[File.read(File.expand_path("summary_fix.js", __dir__)).freeze].freeze
HEADERS =
{ "Content-Type" => "application/javascript" }.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.enabledObject

Returns the value of attribute enabled.



11
12
13
# File 'lib/sidekiq/throttled/web/summary_fix.rb', line 11

def enabled
  @enabled
end

Class Method Details

.apply!(app) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/sidekiq/throttled/web/summary_fix.rb', line 13

def apply!(app)
  Sidekiq::WebAction.prepend SummaryFix

  app.get("/throttled/summary_fix") do
    [200, HEADERS.dup, JAVASCRIPT.dup]
  end
end

Instance Method Details

#display_custom_headObject



22
23
24
# File 'lib/sidekiq/throttled/web/summary_fix.rb', line 22

def display_custom_head
  "#{super}#{summary_fix_script if SummaryFix.enabled}"
end