Skip to content

Commit

Permalink
Style
Browse files Browse the repository at this point in the history
  • Loading branch information
carllerche committed Feb 21, 2011
1 parent eaa1747 commit 62d459c
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions lib/kirk/client/group.rb
Expand Up @@ -3,18 +3,24 @@
module Kirk
class Client
class Group

attr_reader :responses, :queue, :block, :client
alias :block? :block
attr_reader :client, :host, :options, :responses, :queue

def initialize(client = Client.new, options = {})
@block = options.include?(:block) ? options[:block] : true
@options = options
fetch_host
@queue = LinkedBlockingQueue.new
@client = client
@client = client
@queue = LinkedBlockingQueue.new

@requests_count = 0
@responses = []
@responses = []

if @options[:host]
@host = @options.delete(:host).chomp('/')
@host = "http://#{@host}" unless @host =~ /^https?:\/\//
end
end

def block?
options.key?(:block) ? options[:block] : true
end

def start
Expand All @@ -39,7 +45,7 @@ def complete
def request(method = nil, url = nil, handler = nil, headers = {})
request = Request.new(self, method, url, handler, headers)
yield request if block_given?
request.url URI.join(@host, request.url).to_s if @host
request.url URI.join(host, request.url).to_s if host
queue_request(request)
request
end
Expand Down Expand Up @@ -71,13 +77,6 @@ def get_responses
def completed
complete.call if complete
end

def fetch_host
if @options[:host]
@host = @options.delete(:host).chomp('/')
@host = "http://#{@host}" unless @host =~ /^https?:\/\//
end
end
end
end
end

0 comments on commit 62d459c

Please sign in to comment.