lib/benchmark/http/statistics.rb in benchmark-http-0.10.0 vs lib/benchmark/http/statistics.rb in benchmark-http-0.11.0
- old
+ new
@@ -158,9 +158,15 @@
# The count of the status codes seen in the responses:
@responses = Hash.new{|h,k| 0}
end
+ attr :responses
+
+ def failed
+ @responses.sum{|status, count| status >= 400 ? count : 0}
+ end
+
def add(duration, result)
super
@responses[result.status] += 1
end