lib/bumbler/progress.rb in bumbler-0.1.3 vs lib/bumbler/progress.rb in bumbler-0.1.4
- old
+ new
@@ -46,10 +46,10 @@
end
def bar(width)
inner_size = width - 2
- fill_size = ((@loaded_items.to_f / @item_count.to_f) * inner_size).to_i
+ fill_size = [((@loaded_items.to_f / @item_count.to_f) * inner_size).to_i, inner_size].min
fill = '#' * fill_size
empty = ' ' * (inner_size - fill_size)
return "[#{fill}#{empty}]"
end