Sha256: 1b0aa8dd0b5202bdbd60aafecd52738d3340d09e62858660276340e305080075

Contents?: true

Size: 823 Bytes

Versions: 6984

Compression:

Stored size: 823 Bytes

Contents

require 'ruby-progressbar/output'

class   ProgressBar
module  Outputs
class   NonTty < Output
  DEFAULT_FORMAT_STRING = '%t: |%b|'.freeze

  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.to_s
  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_writer :last_update_length
end
end
end

Version data entries

6,984 entries across 6,933 versions & 60 rubygems

Version Path
cybrid_api_bank_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_id_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_organization_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_bank_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_id_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_organization_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_bank_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_organization_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_id_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
ory-client-1.16.2 vendor/bundle/ruby/3.1.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
avalara_sdk-24.12.2 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_bank_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_organization_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_id_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_bank_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_id_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_organization_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
ory-client-1.16.1 vendor/bundle/ruby/3.1.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
ory-client-1.16.0 vendor/bundle/ruby/3.1.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb
cybrid_api_bank_ruby-0.123.143 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb