Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 24 lines (22 sloc) 0.539 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
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
Something went wrong with that request. Please try again.