Module: Collimator::ProgressBar
- Defined in:
- lib/collimator/progress_bar.rb
Class Method Summary collapse
- .clear ⇒ Object
- .complete ⇒ Object
- .increment ⇒ Object
- .set_parameters(params) ⇒ Object
- .start(params = {}) ⇒ Object
Class Method Details
.clear ⇒ Object
34 35 36 |
# File 'lib/collimator/progress_bar.rb', line 34 def self.clear print "\b"*(@display_width + 2) end |
.complete ⇒ Object
29 30 31 32 |
# File 'lib/collimator/progress_bar.rb', line 29 def self.complete clear puts " "*(@display_width + 2) end |
.increment ⇒ Object
24 25 26 27 |
# File 'lib/collimator/progress_bar.rb', line 24 def self.increment @current += @step_size put_current_progress unless @current > @max end |
.set_parameters(params) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/collimator/progress_bar.rb', line 10 def self.set_parameters(params) @display_width = params[:display_width] if params.has_key?(:display_width) @max = params[:max] if params.has_key?(:max) @min = params[:min] if params.has_key?(:min) @method = params[:method] if params.has_key?(:method) @step_size = params[:step_size] if params.has_key?(:step_size) end |
.start(params = {}) ⇒ Object
18 19 20 21 22 |
# File 'lib/collimator/progress_bar.rb', line 18 def self.start(params = {}) set_parameters params @current = @min put_current_progress end |