Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 408bbddc93
Fetching contributors…

Cannot retrieve contributors at this time

24 lines (22 sloc) 0.539 kb
require 'beanstalk-client'
require 'json'
require 'uri'
require 'timeout'
module Beandip
class Application < Sinatra::Base
def beanstalk
@@beanstalk ||= Beanstalk::Pool.new([ beanstalk_host_and_port ])
end
def beanstalk_url
ENV['BEANSTALK_URL'] || 'beanstalk://localhost/'
end
def beanstalk_host_and_port
uri = URI.parse(beanstalk_url)
raise(BadURL, beanstalk_url) if uri.scheme != 'beanstalk'
return "#{uri.host}:#{uri.port || 11300}"
end
get '/' do
erb :index
end
end
end
Jump to Line
Something went wrong with that request. Please try again.