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


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

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

.url_prefixObject


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

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

.url_prefix=(url_prefix) ⇒ Object


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

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

Instance Method Details

#resqueObject


281
282
283
# File 'lib/resque/server.rb', line 281

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