Class: Resque::Server

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/resque/server.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.tabsObject


290
291
292
# File 'lib/resque/server.rb', line 290

def self.tabs
  @tabs ||= ["Overview", "Working", "Failed", "Queues", "Workers", "Stats"]
end

.url_prefixObject


298
299
300
# File 'lib/resque/server.rb', line 298

def self.url_prefix
  (@url_prefix.nil? || @url_prefix.empty?) ? '' : @url_prefix + '/'
end

.url_prefix=(url_prefix) ⇒ Object


294
295
296
# File 'lib/resque/server.rb', line 294

def self.url_prefix=(url_prefix)
  @url_prefix = url_prefix
end

Instance Method Details

#resqueObject


286
287
288
# File 'lib/resque/server.rb', line 286

def resque
  Resque
end

#show(page, layout = true) ⇒ Object


142
143
144
145
146
147
148
149
# File 'lib/resque/server.rb', line 142

def show(page, layout = true)
  response["Cache-Control"] = "max-age=0, private, must-revalidate"
  begin
    erb page.to_sym, {:layout => layout}, :resque => Resque
  rescue Errno::ECONNREFUSED
    erb :error, {:layout => false}, :error => "Can't connect to Redis! (#{Resque.redis_id})"
  end
end

#show_for_polling(page) ⇒ Object


151
152
153
154
155
# File 'lib/resque/server.rb', line 151

def show_for_polling(page)
  content_type "text/html"
  @polling = true
  show(page.to_sym, false).gsub(/\s{1,}/, ' ')
end