Sha256: 1b0aa8dd0b5202bdbd60aafecd52738d3340d09e62858660276340e305080075

Contents?: true

Size: 823 Bytes

Versions: 7145

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

7,145 entries across 7,094 versions & 62 rubygems

Version Path
ory-kratos-client-0.7.6.alpha5 vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
ory-kratos-client-0.7.6.alpha4 vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
ory-kratos-client-0.7.6.alpha3 vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
ory-kratos-client-0.7.6.alpha1 vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
ory-kratos-client-0.7.5.alpha2 vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
mx-platform-ruby-0.4.0 vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
mx-platform-ruby-0.3.2 vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
mx-platform-ruby-0.3.1 vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
passbase-1.3.0 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/outputs/non_tty.rb
cocRb-0.1.0 .bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
mfk_openapi_ruby_client-1.0.0 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/outputs/non_tty.rb
progressbar-1.11.0 lib/ruby-progressbar/outputs/non_tty.rb
ruby-progressbar-1.11.0 lib/ruby-progressbar/outputs/non_tty.rb
passbase-1.2.0 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/outputs/non_tty.rb
passbase-1.1.0 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/outputs/non_tty.rb
passbase-1.0.3 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/outputs/non_tty.rb
passbase-1.0.2 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/outputs/non_tty.rb
passbase-1.0.1 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/outputs/non_tty.rb
passbase-1.0.0 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/outputs/non_tty.rb