Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. times = ARGV.map { |f| [f.split(?.).first, File.readlines(f).map { |l| l.split[-1].to_f }] }.to_h
  2.  
  3. def colour(s, rat)
  4. code = if rat == 1
  5. 34
  6. elsif rat <= 2
  7. 32
  8. elsif rat <= 5
  9. 33
  10. else
  11. 31
  12. end
  13. "\e[1;#{code}m#{s}\e[0m"
  14. end
  15.  
  16. puts ' ' + times.keys.map { |k| '%6s' % k }.join(' ')
  17. 25.times { |n|
  18. left = '%2d ' % (n + 1)
  19. mintime = times.values.map { |vs| vs[n] }.min
  20. ratios = times.values.map { |vs| vs[n] / mintime }
  21. puts left + ratios.map { |r| colour('%6.2f' % r, r) }.join(' ')
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement