Class: Hydra::Listener::ProgressBar

Inherits:
Abstract
  • Object
show all
Defined in:
lib/hydra/listener/progress_bar.rb

Overview

Output a progress bar as files are completed

Instance Method Summary collapse

Methods inherited from Abstract

#file_begin, #initialize, #worker_begin, #worker_end

Constructor Details

This class inherits a constructor from Hydra::Listener::Abstract

Instance Method Details

#file_end(file, output) ⇒ Object

Increment completed files count and update bar


15
16
17
18
19
20
21
22
# File 'lib/hydra/listener/progress_bar.rb', line 15

def file_end(file, output)
  unless output == '.'
    @output.write "\r#{' '*60}\r#{output}\n"
    @errors = true
  end
  @files_completed += 1
  render_progress_bar
end

#testing_begin(files) ⇒ Object

Store the total number of files


6
7
8
9
10
11
12
# File 'lib/hydra/listener/progress_bar.rb', line 6

def testing_begin(files)
  @total_files = files.size
  @files_completed = 0
  @test_output = ""
  @errors = false
  render_progress_bar
end

#testing_endObject

Break the line


25
26
27
28
# File 'lib/hydra/listener/progress_bar.rb', line 25

def testing_end
  render_progress_bar
  @output.write "\n"
end