Module: Resque::Plugins::Fifo::Server::Helpers

Defined in:
lib/resque/plugins/fifo/server.rb

Instance Method Summary collapse

Instance Method Details

#pollObject



10
11
12
13
14
15
16
17
# File 'lib/resque/plugins/fifo/server.rb', line 10

def poll
  if @polling
    text = "Last Updated: #{Time.now.strftime("%H:%M:%S")}"
  else
    text = "<a href='#{u(request.path_info)}.poll' rel='poll'>Live Poll</a>"
  end
  "<p class='poll'>#{text}</p>"
end

#show_page(page, layout = true) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/resque/plugins/fifo/server.rb', line 19

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