Class: ProgressBar::Outputs::NonTty
Constant Summary
collapse
- DEFAULT_FORMAT_STRING =
'%t: |%b|'.freeze
ProgressBar::Output::DEFAULT_OUTPUT_STREAM
Instance Attribute Summary collapse
#stream
Instance Method Summary
collapse
#clear_string, detect, #initialize, #length, #log, #refresh, #with_refresh
Instance Attribute Details
#last_update_length ⇒ Object
14
15
16
|
# File 'lib/ruby-progressbar/outputs/non_tty.rb', line 14
def last_update_length
@last_update_length ||= 0
end
|
Instance Method Details
#bar_update_string ⇒ Object
18
19
20
21
22
23
24
25
26
|
# File 'lib/ruby-progressbar/outputs/non_tty.rb', line 18
def bar_update_string
formatted_string = bar.to_s
formatted_string = formatted_string[0...-1] unless bar.finished?
output_string = formatted_string[last_update_length..-1]
self.last_update_length = formatted_string.length
output_string.to_s
end
|
#clear ⇒ Object
8
9
10
11
12
|
# File 'lib/ruby-progressbar/outputs/non_tty.rb', line 8
def clear
self.last_update_length = 0
stream.print "\n"
end
|
28
29
30
|
# File 'lib/ruby-progressbar/outputs/non_tty.rb', line 28
def default_format
DEFAULT_FORMAT_STRING
end
|
#eol ⇒ Object
38
39
40
|
# File 'lib/ruby-progressbar/outputs/non_tty.rb', line 38
def eol
bar.stopped? ? "\n" : ''
end
|
36
|
# File 'lib/ruby-progressbar/outputs/non_tty.rb', line 36
def refresh_with_format_change(*); end
|
32
33
34
|
# File 'lib/ruby-progressbar/outputs/non_tty.rb', line 32
def resolve_format(*)
default_format
end
|