Class: WGif::DownloadBar

Inherits:
Object
  • Object
show all
Defined in:
lib/wgif/download_bar.rb

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDownloadBar

Returns a new instance of DownloadBar.



11
12
13
14
15
16
17
# File 'lib/wgif/download_bar.rb', line 11

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

Instance Attribute Details

#progress_barObject (readonly)

Returns the value of attribute progress_bar.



9
10
11
# File 'lib/wgif/download_bar.rb', line 9

def progress_bar
  @progress_bar
end

Instance Method Details

#increment_progress(size) ⇒ Object



23
24
25
# File 'lib/wgif/download_bar.rb', line 23

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

#update_total(size) ⇒ Object



19
20
21
# File 'lib/wgif/download_bar.rb', line 19

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