Class: Sidekiq::Web
- Inherits:
-
Object
- Object
- Sidekiq::Web
- Defined in:
- lib/sidekiq/web.rb
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", }
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.
-
.session_secret ⇒ Object
Returns the value of attribute session_secret.
-
.sessions ⇒ Object
Returns the value of attribute sessions.
- .views ⇒ Object
Instance Attribute Summary collapse
Class Method Summary collapse
- .call(env) ⇒ 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
Helper for the Sinatra syntax: Sidekiq::Web.set(:session_secret, Rails.application.secrets…).
- .settings ⇒ Object
- .use(*middleware_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(*middleware_args, &block) ⇒ Object
Class Attribute Details
.app_url ⇒ Object
Returns the value of attribute app_url.
80 81 82 |
# File 'lib/sidekiq/web.rb', line 80 def app_url @app_url end |
.locales ⇒ Object
59 60 61 |
# File 'lib/sidekiq/web.rb', line 59 def locales @locales ||= LOCALES end |
.redis_pool ⇒ Object
Returns the value of attribute redis_pool.
80 81 82 |
# File 'lib/sidekiq/web.rb', line 80 def redis_pool @redis_pool end |
.session_secret ⇒ Object
Returns the value of attribute session_secret.
80 81 82 |
# File 'lib/sidekiq/web.rb', line 80 def session_secret @session_secret end |
.sessions ⇒ Object
Returns the value of attribute sessions.
80 81 82 |
# File 'lib/sidekiq/web.rb', line 80 def sessions @sessions end |
.views ⇒ Object
63 64 65 |
# File 'lib/sidekiq/web.rb', line 63 def views @views ||= VIEWS end |
Instance Attribute Details
#sessions ⇒ Object
133 134 135 136 137 138 139 140 |
# File 'lib/sidekiq/web.rb', line 133 def sessions unless instance_variable_defined?("@sessions") @sessions = self.class.sessions @sessions = @sessions.to_hash.dup if @sessions.respond_to?(:to_hash) end @sessions end |
Class Method Details
.call(env) ⇒ Object
107 108 109 110 |
# File 'lib/sidekiq/web.rb', line 107 def self.call(env) @app ||= new @app.call(env) end |
.custom_tabs ⇒ Object Also known as: tabs
54 55 56 |
# File 'lib/sidekiq/web.rb', line 54 def custom_tabs @custom_tabs ||= {} end |
.default_tabs ⇒ Object
50 51 52 |
# File 'lib/sidekiq/web.rb', line 50 def default_tabs DEFAULT_TABS end |
.disable(*opts) ⇒ Object
71 72 73 |
# File 'lib/sidekiq/web.rb', line 71 def disable(*opts) opts.each { |key| set(key, false) } end |
.enable(*opts) ⇒ Object
67 68 69 |
# File 'lib/sidekiq/web.rb', line 67 def enable(*opts) opts.each { |key| set(key, true) } end |
.inherited(child) ⇒ Object
84 85 86 87 88 89 |
# File 'lib/sidekiq/web.rb', line 84 def self.inherited(child) child.app_url = app_url child.session_secret = session_secret child.redis_pool = redis_pool child.sessions = sessions end |
.middlewares ⇒ Object
42 43 44 |
# File 'lib/sidekiq/web.rb', line 42 def middlewares @middlewares ||= [] end |
.register(extension) ⇒ Object
142 143 144 |
# File 'lib/sidekiq/web.rb', line 142 def self.register(extension) extension.registered(WebApplication) end |
.set(attribute, value) ⇒ Object
Helper for the Sinatra syntax: Sidekiq::Web.set(:session_secret, Rails.application.secrets…)
76 77 78 |
# File 'lib/sidekiq/web.rb', line 76 def set(attribute, value) send(:"#{attribute}=", value) end |
.settings ⇒ Object
38 39 40 |
# File 'lib/sidekiq/web.rb', line 38 def settings self end |
.use(*middleware_args, &block) ⇒ Object
46 47 48 |
# File 'lib/sidekiq/web.rb', line 46 def use(*middleware_args, &block) middlewares << [middleware_args, block] end |
Instance Method Details
#app ⇒ Object
112 113 114 |
# File 'lib/sidekiq/web.rb', line 112 def app @app ||= build end |
#call(env) ⇒ Object
103 104 105 |
# File 'lib/sidekiq/web.rb', line 103 def call(env) app.call(env) end |
#disable(*opts) ⇒ Object
120 121 122 |
# File 'lib/sidekiq/web.rb', line 120 def disable(*opts) opts.each { |key| set(key, false) } end |
#enable(*opts) ⇒ Object
116 117 118 |
# File 'lib/sidekiq/web.rb', line 116 def enable(*opts) opts.each { |key| set(key, true) } end |
#middlewares ⇒ Object
99 100 101 |
# File 'lib/sidekiq/web.rb', line 99 def middlewares @middlewares ||= Web.middlewares.dup end |
#set(attribute, value) ⇒ Object
124 125 126 |
# File 'lib/sidekiq/web.rb', line 124 def set(attribute, value) send(:"#{attribute}=", value) end |
#settings ⇒ Object
91 92 93 |
# File 'lib/sidekiq/web.rb', line 91 def settings self.class.settings end |
#use(*middleware_args, &block) ⇒ Object
95 96 97 |
# File 'lib/sidekiq/web.rb', line 95 def use(*middleware_args, &block) middlewares << [middleware_args, block] end |