Sha256: 6f48ca0753a23f0798bd632f58afd1d68c5a6540611e86ee8256828a1ab5288d
Contents?: true
Size: 813 Bytes
Versions: 2
Compression:
Stored size: 813 Bytes
Contents
require 'ruby-progressbar/output' class ProgressBar module Outputs class NonTty < Output DEFAULT_FORMAT_STRING = '%t: |%b|' def clear self.last_update_length = 0 stream.print "\n" end def last_update_length @last_update_length ||= 0 end 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 end def default_format DEFAULT_FORMAT_STRING end def resolve_format(*) default_format end def refresh_with_format_change(*); end def eol bar.stopped? ? "\n" : '' end protected attr_accessor :last_update_length end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-progressbar-1.7.1 | lib/ruby-progressbar/outputs/non_tty.rb |
ruby-progressbar-1.7.0 | lib/ruby-progressbar/outputs/non_tty.rb |