class AsciiParadise::ProgressBar
Constants
- INTERVAL
#¶ ↑
INTERVAL
¶ ↑How long we will wait. The larger, the slower the progress-bar will appear.
#¶ ↑
- LENGTH
#¶ ↑
The length of the AsciiBar comes next. The higher, the longer the bar.
#¶ ↑
- START
#¶ ↑
START
¶ ↑#¶ ↑
Public Class Methods
Public Instance Methods
reset()
click to toggle source
run()
click to toggle source
run_the_progress_bar()
click to toggle source
#¶ ↑
run_the_progress_bar
¶ ↑
#¶ ↑
# File lib/ascii_paradise/animations/progress_bar.rb, line 55 def run_the_progress_bar @length.times {|i| output_string = START.dup # Need .dup here because otherwise the START-string will be appended. @length.times {|x| # =================================================================== # # Next we build up our output string. This string will fluctate # at every interval. # =================================================================== # output_string << ( x == i && ( i % 2 == 0 && 'C'||'c')|| (x < i && '-' || ( x % 2 == 0 && ' '|| 'o' )) ) } print output_string+']' STDOUT.flush sleep INTERVAL } e end