Class: CLIProgressBar::ProgressBar
- Inherits:
-
Object
- Object
- CLIProgressBar::ProgressBar
- Defined in:
- lib/cli_progress_bar/progress_bar.rb
Overview
Parent progress bar class to be inherited from only.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#progress ⇒ Object
readonly
Returns the value of attribute progress.
Instance Method Summary collapse
-
#initialize(of: "", log_at: LOG_AT_TEN_PERCENTS, bar_length: BAR_LENGTH, line_char: LINE_CHAR, prefix: "", suffix: "", stream: STD_OUT) ⇒ ProgressBar
constructor
A new instance of ProgressBar.
Constructor Details
#initialize(of: "", log_at: LOG_AT_TEN_PERCENTS, bar_length: BAR_LENGTH, line_char: LINE_CHAR, prefix: "", suffix: "", stream: STD_OUT) ⇒ ProgressBar
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cli_progress_bar/progress_bar.rb', line 6 def initialize( of: "", log_at: LOG_AT_TEN_PERCENTS, bar_length: BAR_LENGTH, line_char: LINE_CHAR, prefix: "", suffix: "", stream: STD_OUT ) raise "bar_length: must be positive and even" unless .positive? && .even? raise "stream: must respond to #puts" unless stream.respond_to?(:puts) @progress = 0 @of = of.to_s @log_at = log_at @bar_length = @line_char = line_char @prefix = prefix @suffix = suffix @stream = stream end |
Instance Attribute Details
#progress ⇒ Object (readonly)
Returns the value of attribute progress.
4 5 6 |
# File 'lib/cli_progress_bar/progress_bar.rb', line 4 def progress @progress end |