Sha256: 02d456a2231c9506c60107644344194318b829c04708f7d1249ea509707624f5

Contents?: true

Size: 453 Bytes

Versions: 3

Compression:

Stored size: 453 Bytes

Contents

require 'ruby-progressbar'

module WGif
  class DownloadBar

    FORMAT = '==> %p%% |%B|'
    SMOOTHING = 0.8

    attr_reader :progress_bar

    def initialize
      @progress_bar = ProgressBar.create(
        format: FORMAT,
        smoothing: SMOOTHING,
        total: @size
      )
    end

    def update_total(size)
      @progress_bar.total = size
    end

    def increment_progress(size)
      @progress_bar.progress += size
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wgif-0.2.0 lib/wgif/download_bar.rb
wgif-0.0.1 lib/wgif/download_bar.rb
wgif-0.0.1.pre lib/wgif/download_bar.rb