Class: MinitestBender::Printers::WithProgressBar
- Inherits:
-
Object
- Object
- MinitestBender::Printers::WithProgressBar
- Defined in:
- lib/minitest-bender/printers/with_progress_bar.rb
Constant Summary collapse
- COMPLETE_ICON =
' '- HEAD_ICON =
'ᗧ'- INCOMPLETE_ICON =
'•'- ELAPSED_ICON =
'⏱'- ETA_ICON =
'⌛'
Instance Method Summary collapse
- #advance ⇒ Object
-
#initialize(io, total) ⇒ WithProgressBar
constructor
A new instance of WithProgressBar.
- #print(string) ⇒ Object
- #print_line(line = '') ⇒ Object
- #print_lines(lines) ⇒ Object
Constructor Details
#initialize(io, total) ⇒ WithProgressBar
Returns a new instance of WithProgressBar.
15 16 17 18 19 |
# File 'lib/minitest-bender/printers/with_progress_bar.rb', line 15 def initialize(io, total) @io = io @total = total = end |
Instance Method Details
#advance ⇒ Object
37 38 39 40 |
# File 'lib/minitest-bender/printers/with_progress_bar.rb', line 37 def advance .update({ head: head }) .advance(1, { counters_sym => counters }) end |
#print(string) ⇒ Object
21 22 23 |
# File 'lib/minitest-bender/printers/with_progress_bar.rb', line 21 def print(string) io.print(string) end |
#print_line(line = '') ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/minitest-bender/printers/with_progress_bar.rb', line 25 def print_line(line = '') if io.tty? .log(line) else io.puts(line) end end |
#print_lines(lines) ⇒ Object
33 34 35 |
# File 'lib/minitest-bender/printers/with_progress_bar.rb', line 33 def print_lines(lines) lines.each { |line| print_line(line) } end |