56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/mechanizeprogress.rb', line 56
def progressbar_new(pbar_opts, request, response)
out = pbar_opts[:out] || pbar_opts[:output] || $stderr
format = pbar_opts[:format] || "%j%% %b\e[0;93m\u{15E7}\e[0m%i Progress: %c/%C %a %e Speed: %rKB/sec %t"
if pbar_opts[:single]
title = pbar_opts[:title] || request['Host']
else
title = pbar_opts[:title] || ''
out.print "#{pbar_opts[:title] || uri(request)}\n"
end
total = pbar_opts[:total] || filesize(response)
pbar_class = pbar_opts[:reversed] ? ReversedProgressBar : ProgressBar
pbar_class.create(
title: title,
total: total,
output: out,
length: 120,
format: format,
rate_scale: ->(rate) { rate / 1024 },
progress_mark: ' ',
remainder_mark: "\e[0;34m\u{FF65}\e[0m"
)
end
|