lib/tailstrom/command/stat.rb in tailstrom-0.0.6 vs lib/tailstrom/command/stat.rb in tailstrom-0.0.7
- old
+ new
@@ -38,14 +38,10 @@
@table.print_header
end
print_counters
- if @counters.size > 1
- @table.puts
- end
-
@counters.clear
i = i + 1
end while !reader.eof?
rescue Interrupt
exit 0
@@ -60,19 +56,22 @@
10
end
end
def print_counters
+ printed_lines = 0
sorted_counters.each do |key, c|
key = (key == :nil ? nil : key)
next unless out_filter(key, c)
if @options[:async]
time = Time.now.strftime("%H:%M:%S")
@table.print_row time, c.count, c.min, c.max, c.avg, key
else
@table.print_row c.count, c.min, c.max, c.avg, key
end
+ printed_lines += 1
end
+ @table.puts if printed_lines > 1
end
def sorted_counters
counters = @counters.to_a
if sort = @options[:sort]