Class: Sidekiq::Web
- Inherits:
-
Object
- Object
- Sidekiq::Web
- Defined in:
- lib/sidekiq/web.rb,
lib/sidekiq/web/csrf_protection.rb
Defined Under Namespace
Classes: CsrfProtection
Constant Summary collapse
- ROOT =
File.("#{File.dirname(__FILE__)}/../../web")
- VIEWS =
"#{ROOT}/views"
- LOCALES =
["#{ROOT}/locales"]
- LAYOUT =
"#{VIEWS}/layout.erb"
- ASSETS =
"#{ROOT}/assets"
- DEFAULT_TABS =
{ "Dashboard" => "", "Busy" => "busy", "Queues" => "queues", "Retries" => "retries", "Scheduled" => "scheduled", "Dead" => "morgue", "Metrics" => "metrics" }
- CONTENT_LANGUAGE =
"content-language"
- CONTENT_SECURITY_POLICY =
"content-security-policy"
- LOCATION =
"location"
- X_CASCADE =
"x-cascade"
Class Attribute Summary collapse
-
.app_url ⇒ Object
Returns the value of attribute app_url.
- .locales ⇒ Object
-
.redis_pool ⇒ Object
Returns the value of attribute redis_pool.
- .views ⇒ Object
Class Method Summary collapse
- .call(env) ⇒ Object
- .custom_job_info_rows ⇒ Object
- .custom_tabs ⇒ Object (also: tabs)
- .default_tabs ⇒ Object
- .disable(*opts) ⇒ Object
- .enable(*opts) ⇒ Object
- .inherited(child) ⇒ Object
- .middlewares ⇒ Object
- .register(extension) ⇒ Object
- .set(attribute, value) ⇒ Object
- .settings ⇒ Object
- .use(*args, &block) ⇒ Object
Instance Method Summary collapse
- #app ⇒ Object
- #call(env) ⇒ Object
- #disable(*opts) ⇒ Object
- #enable(*opts) ⇒ Object
- #middlewares ⇒ Object
- #set(attribute, value) ⇒ Object
- #settings ⇒ Object
- #use(*args, &block) ⇒ Object
Class Attribute Details
.app_url ⇒ Object
Returns the value of attribute app_url.
95 96 97 |
# File 'lib/sidekiq/web.rb', line 95 def app_url @app_url end |
.locales ⇒ Object
67 68 69 |
# File 'lib/sidekiq/web.rb', line 67 def locales @locales ||= LOCALES end |
.redis_pool ⇒ Object
Returns the value of attribute redis_pool.
95 96 97 |
# File 'lib/sidekiq/web.rb', line 95 def redis_pool @redis_pool end |
.views ⇒ Object
71 72 73 |
# File 'lib/sidekiq/web.rb', line 71 def views @views ||= VIEWS end |
Class Method Details
.call(env) ⇒ Object
120 121 122 123 |
# File 'lib/sidekiq/web.rb', line 120 def self.call(env) @app ||= new @app.call(env) end |
.custom_job_info_rows ⇒ Object
63 64 65 |
# File 'lib/sidekiq/web.rb', line 63 def custom_job_info_rows @custom_job_info_rows ||= [] end |
.custom_tabs ⇒ Object Also known as: tabs
58 59 60 |
# File 'lib/sidekiq/web.rb', line 58 def custom_tabs @custom_tabs ||= {} end |
.default_tabs ⇒ Object
54 55 56 |
# File 'lib/sidekiq/web.rb', line 54 def default_tabs DEFAULT_TABS end |
.disable(*opts) ⇒ Object
79 80 81 |
# File 'lib/sidekiq/web.rb', line 79 def disable(*opts) opts.each { |key| set(key, false) } end |
.enable(*opts) ⇒ Object
75 76 77 |
# File 'lib/sidekiq/web.rb', line 75 def enable(*opts) opts.each { |key| set(key, true) } end |
.inherited(child) ⇒ Object
99 100 101 102 |
# File 'lib/sidekiq/web.rb', line 99 def self.inherited(child) child.app_url = app_url child.redis_pool = redis_pool end |
.middlewares ⇒ Object
83 84 85 |
# File 'lib/sidekiq/web.rb', line 83 def middlewares @middlewares ||= [] end |
.register(extension) ⇒ Object
141 142 143 |
# File 'lib/sidekiq/web.rb', line 141 def self.register(extension) extension.registered(WebApplication) end |
.set(attribute, value) ⇒ Object
91 92 93 |
# File 'lib/sidekiq/web.rb', line 91 def set(attribute, value) send(:"#{attribute}=", value) end |
.settings ⇒ Object
50 51 52 |
# File 'lib/sidekiq/web.rb', line 50 def settings self end |
.use(*args, &block) ⇒ Object
87 88 89 |
# File 'lib/sidekiq/web.rb', line 87 def use(*args, &block) middlewares << [args, block] end |
Instance Method Details
#app ⇒ Object
125 126 127 |
# File 'lib/sidekiq/web.rb', line 125 def app @app ||= build end |
#call(env) ⇒ Object
116 117 118 |
# File 'lib/sidekiq/web.rb', line 116 def call(env) app.call(env) end |
#disable(*opts) ⇒ Object
133 134 135 |
# File 'lib/sidekiq/web.rb', line 133 def disable(*opts) opts.each { |key| set(key, false) } end |
#enable(*opts) ⇒ Object
129 130 131 |
# File 'lib/sidekiq/web.rb', line 129 def enable(*opts) opts.each { |key| set(key, true) } end |
#middlewares ⇒ Object
108 109 110 |
# File 'lib/sidekiq/web.rb', line 108 def middlewares @middlewares ||= self.class.middlewares end |
#set(attribute, value) ⇒ Object
137 138 139 |
# File 'lib/sidekiq/web.rb', line 137 def set(attribute, value) send(:"#{attribute}=", value) end |
#settings ⇒ Object
104 105 106 |
# File 'lib/sidekiq/web.rb', line 104 def settings self.class.settings end |
#use(*args, &block) ⇒ Object
112 113 114 |
# File 'lib/sidekiq/web.rb', line 112 def use(*args, &block) middlewares << [args, block] end |