lib/httping/ping.rb in httping-1.0.0 vs lib/httping/ping.rb in httping-1.0.1
- old
+ new
@@ -7,15 +7,18 @@
@ping_results = []
end
def run
trap("INT") { results }
+
loop do
ping
- results if count_reached?
+ break if count_reached?
sleep @delay unless @flood
end
+
+ results
end
def ping
start_time = Time.now
response, data = request.get(uri, http_header)
@@ -57,15 +60,10 @@
def beep
7.chr
end
def results
- if @format.nil?
- interactive_results
- else
- send("#{@format}_results")
- end
-
+ send("#{@format}_results")
exit
end
def interactive_results
puts
\ No newline at end of file