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



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

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

.url_prefixObject



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

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

.url_prefix=(url_prefix) ⇒ Object



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

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

Instance Method Details

#resqueObject



283
284
285
# File 'lib/resque/server.rb', line 283

def resque
  Resque
end

#show(page, layout = true) ⇒ Object



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

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



153
154
155
156
157
# File 'lib/resque/server.rb', line 153

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