Method: Experiment::Notify::ProgressBar#show

Defined in:
lib/experiment/notify.rb

#showObject



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/experiment/notify.rb', line 116

def show
  percent = @current  * 100.0 / @total
  bar_width = percent * @terminal_width / 100.0
  line = sprintf "%3d%% |%s%s| %s", percent, "=" * bar_width.floor, "-" * (@terminal_width - bar_width.ceil), stat


  #width = get_width
  #if line.length == width - 1 
    @out.print(line +  (@finished_p ? "\n" : "\r"))
    @out.flush
  #elsif line.length >= width
  #  @terminal_width = [@terminal_width - (line.length - width + 1), 0].max
  #  if @terminal_width == 0 then @out.print(line + (@finished_p ? "\n" : "\r")) else show end
  #else # line.length < width - 1
  #  @terminal_width += width - line.length + 1
  #  show
  #end
  @previous_time = Time.now
end