def stats_display(args)
spacing = args[:spacing] || false
results = args[:results] || true
prefix = args[:prefix] || ''
indent = args[:indent] || "#{prefix} "
first = true
@stats.keys.sort!.each do | key |
data = @stats[key]
puts if spacing and not first
first = false
printf "#{prefix}%5.1f%%: ", data[:prob] * 100
response = data[:response]
referral = data[:referral]
where = "#{referral.server} (#{response.ip})"
case response.status
when :exception
puts "#{response.exception_message} at #{where}"
when :noglue
puts "No glue at #{referral.parent.server} " +
"(#{response.ip}) for #{response.server}"
when :error
puts "#{response.error_message} at #{where}"
when :nodata
puts "NODATA (for this type) at #{where})"
when :answered
puts "Answer from #{where}"
if results then
for rr in data[:response].answers do
puts "#{indent}#{rr}"
end
end
else
puts "Stopped at #{where})"
puts "#{indent}#{key}"
end
if response.status != :answered and
((response.qname != @qname) or (response.qclass != @qclass) or
(response.qtype != @qtype)) then
puts "#{indent}While querying #{response.qname}/" +
"#{response.qclass}/#{response.qtype}"
end
end
end