lib/formatador/progressbar.rb in formatador-0.0.11 vs lib/formatador/progressbar.rb in formatador-0.0.12
- old
+ new
@@ -18,10 +18,14 @@
started_at = options[:started_at]
width = options[:width]
output = []
+ if options[:label]
+ output << options[:label]
+ end
+
padding = ' ' * (total.to_s.size - current.to_s.size)
output << "[#{color}]#{padding}#{current}/#{total}[/]"
percent = current.to_f / total.to_f
output << "[_white_]|[/][#{color}][_#{color}_]#{'*' * (percent * width).ceil}[/]#{' ' * (width - (percent * width).ceil)}[_white_]|[/]"
@@ -32,9 +36,9 @@
seconds = (elapsed % 60).round.to_s
output << "#{minutes}:#{'0' if seconds.size < 2}#{seconds}"
end
output << ''
- output.join(' ')
+ output.join(' ')
end
end