lib/progress_bar.rb in progress_bar-1.0.2 vs lib/progress_bar.rb in progress_bar-1.0.3

- old
+ new

@@ -42,11 +42,11 @@ def remaining max - count end def ratio - count.to_f / max + [count.to_f / max, 1.0].min # never go above 1, even if count > max end def percentage ratio * 100 end @@ -125,10 +125,12 @@ "[%#{max_width+3}.2f/s]" % rate end def terminal_width # HighLine check takes a long time, so only update width every second. - if @last_width_adjustment.nil? || ::Time.now - @last_width_adjustment > 1 + if @terminal_width.nil? || @last_width_adjustment.nil? || + ::Time.now - @last_width_adjustment > 1 + @last_width_adjustment = ::Time.now @terminal_width = @hl.output_cols.to_i if @terminal_width < 1 @terminal_width = 80 end