Class: ProgressBar::Base
Constant Summary
collapse
- DEFAULT_OUTPUT_STREAM =
STDOUT
Constants included
from Depreciable
Depreciable::DEPRECATION_DATE
Constants included
from Formatter
Formatter::DEFAULT_FORMAT_STRING, Formatter::DEFAULT_TITLE
Instance Method Summary
collapse
#backwards_compatible_args_to_options_conversion, #bar_mark=, #current, #file_transfer_mode, #format=, #format_arguments=, #halt, #inc, #set, #smoothing, #smoothing=, #start_time, #start_time=, #title_width, #title_width=
Methods included from Formatter
#format, #progress, #total
Constructor Details
#initialize(*args) ⇒ Base
Returns a new instance of Base.
Instance Method Details
#clear ⇒ Object
101
102
103
|
# File 'lib/progress_bar/base.rb', line 101
def clear
output.print clear_string
end
|
#decrement ⇒ Object
Updating The Bar’s Progress
39
40
41
|
# File 'lib/progress_bar/base.rb', line 39
def decrement
with_update { with_progressables(:decrement) }
end
|
#finish ⇒ Object
54
55
56
|
# File 'lib/progress_bar/base.rb', line 54
def finish
with_update { with_progressables(:finish) }
end
|
#finished? ⇒ Boolean
83
84
85
|
# File 'lib/progress_bar/base.rb', line 83
def finished?
@bar.progress == @bar.total
end
|
#increment ⇒ Object
43
44
45
|
# File 'lib/progress_bar/base.rb', line 43
def increment
with_update { with_progressables(:increment) }
end
|
#inspect ⇒ Object
115
116
117
|
# File 'lib/progress_bar/base.rb', line 115
def inspect
"#<ProgressBar:#{progress}/#{total}>"
end
|
#pause ⇒ Object
58
59
60
|
# File 'lib/progress_bar/base.rb', line 58
def pause
with_update { with_timers(:pause) }
end
|
#progress=(new_progress) ⇒ Object
47
48
49
|
# File 'lib/progress_bar/base.rb', line 47
def progress=(new_progress)
with_update { with_progressables(:progress=, new_progress) }
end
|
#progress_mark=(mark) ⇒ Object
90
91
92
|
# File 'lib/progress_bar/base.rb', line 90
def progress_mark=(mark)
with_update { @bar.progress_mark = mark }
end
|
#refresh ⇒ Object
105
106
107
|
# File 'lib/progress_bar/base.rb', line 105
def refresh
update
end
|
#reset ⇒ Object
70
71
72
73
74
75
|
# File 'lib/progress_bar/base.rb', line 70
def reset
with_update do
@bar.reset
with_timers(:reset)
end
end
|
#resume ⇒ Object
66
67
68
|
# File 'lib/progress_bar/base.rb', line 66
def resume
with_update { with_timers(:resume) }
end
|
#start(options = {}) ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/progress_bar/base.rb', line 27
def start(options = {})
clear
with_update do
with_progressables(:start, options)
@elapsed_time.start
end
end
|
#stop ⇒ Object
62
63
64
|
# File 'lib/progress_bar/base.rb', line 62
def stop
with_update { with_timers(:stop) }
end
|
#stopped? ⇒ Boolean
Also known as:
paused?
77
78
79
|
# File 'lib/progress_bar/base.rb', line 77
def stopped?
@estimated_time.stopped? && @elapsed_time.stopped?
end
|
#title=(title) ⇒ Object
94
95
96
|
# File 'lib/progress_bar/base.rb', line 94
def title=(title)
with_update { super }
end
|
#to_s(format_string = nil) ⇒ Object
109
110
111
112
113
|
# File 'lib/progress_bar/base.rb', line 109
def to_s(format_string = nil)
format_string ||= @format_string
format(format_string)
end
|