lib/luck/progressbar.rb in luck-0.1.5 vs lib/luck/progressbar.rb in luck-0.1.6
- old
+ new
@@ -12,10 +12,11 @@
@postcap = ']'
super
end
def percentage
+ return 0 if @maximum == 0
@value.to_f / @maximum.to_f
end
def template str
@precap, @bar, @arrow, @blank, @postcap = str.unpack 'aaaaa'
@@ -36,9 +37,10 @@
@arrow2 = '>'
super
end
def percentage2
+ return 0 if @maximum2 == 0
@value2.to_f / @maximum2.to_f
end
def template str
@precap, @bar2, @arrow2, @bar, @arrow, @blank, @postcap = str.unpack 'aaaaaaa'