lib/backburner/connection.rb in backburner-0.4.6 vs lib/backburner/connection.rb in backburner-1.0.0

- old
+ new

@@ -8,10 +8,11 @@ # Constructs a backburner connection # `url` can be a string i.e 'localhost:3001' or an array of addresses. def initialize(url) @url = url + @beanstalk = nil connect! end # Sets the delegator object to the underlying beaneater pool # self.put(...) @@ -22,21 +23,21 @@ protected # Connects to a beanstalk queue def connect! - @beanstalk ||= Beaneater::Pool.new(beanstalk_addresses) + @beanstalk ||= Beaneater.new(beanstalk_addresses) end # Returns the beanstalk queue addresses # # @example # beanstalk_addresses => ["localhost:11300"] # def beanstalk_addresses - uris = self.url.is_a?(Array) ? self.url : self.url.split(/[\s,]+/) - uris.map { |uri| beanstalk_host_and_port(uri) } + uri = self.url.is_a?(Array) ? self.url.first : self.url + beanstalk_host_and_port(uri) end # Returns a host and port based on the uri_string given # # @example @@ -46,6 +47,6 @@ uri = URI.parse(uri_string) raise(BadURL, uri_string) if uri.scheme != 'beanstalk' "#{uri.host}:#{uri.port || 11300}" end end # Connection -end # Backburner \ No newline at end of file +end # Backburner