# File dev/net_http.rb, line 47 def initialize loops @total_loops, @loops = loops, 0 end
# File dev/net_http.rb, line 64 def all_requests_done? @loops >= @total_loops end
# File dev/net_http.rb, line 51 def request! http = EventMachine::HttpRequest.new('http://localhost:3000').get http.callback { |http| @loops += 1 http.response all_requests_done? ? EM.stop : request! } http.errback { |http| puts "EventMachine Request Error: #{http.error} #{http.inspect}" EM.stop } end