Method: ConsoleProgress::ETA#initialize

Defined in:
lib/console_progress.rb

#initialize(steps, format: nil, current_step: 0) ⇒ ETA

Returns a new instance of ETA.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/console_progress.rb', line 12

def initialize(steps, format: nil, current_step: 0)
  @steps = steps
  @format = format
  @message_prefix = 'ETA'
  @format ||= "{{message_prefix}}: {{step}}/{{steps}} "\
              "Remaining: {{time_left}} "\
              "Took: {{step_time}}s Avg: {{avg_time}}s "\
              "Elapsed: {{elapsed_time}}"
  @step = current_step
  @times = []
  start
end