Parent

Archive::Tar::Minitar::Command::ProgressBar

Constants

VERSION

Attributes

title[RW]
total[RW]

Public Class Methods

new(title, total, out = STDERR) click to toggle source
# File lib/archive/tar/minitar/command.rb, line 35
def initialize (title, total, out = STDERR)
  @title = title
  @total = total
  @out = out
  @bar_width = 80
  @bar_mark = "o"
  @current = 0
  @previous = 0
  @is_finished = false
  @start_time = Time.now
  @previous_time = @start_time
  @title_width = 14
  @format = "%-#{@title_width}s %3d%% %s %s"
  @format_arguments = [:title, :percentage, :bar, :stat]
  show
end

Public Instance Methods

file_transfer_mode() click to toggle source
# File lib/archive/tar/minitar/command.rb, line 182
  def file_transfer_mode
  @format_arguments = [:title, :percentage, :bar, :stat_for_file_transfer]  
end
finish() click to toggle source
# File lib/archive/tar/minitar/command.rb, line 194
def finish
  @current = @total
  @is_finished = true
  show_progress
end
format=(format) click to toggle source
# File lib/archive/tar/minitar/command.rb, line 186
def format= (format)
  @format = format
end
format_arguments=(arguments) click to toggle source
# File lib/archive/tar/minitar/command.rb, line 190
def format_arguments= (arguments)
  @format_arguments = arguments
end
halt() click to toggle source
# File lib/archive/tar/minitar/command.rb, line 200
def halt
  @is_finished = true
  show_progress
end
inc(step = 1) click to toggle source
# File lib/archive/tar/minitar/command.rb, line 214
def inc (step = 1)
  @current += step
  @current = @total if @current > @total
  show_progress
  @previous = @current
end
inspect() click to toggle source
# File lib/archive/tar/minitar/command.rb, line 221
def inspect
  "(ProgressBar: #{@current}/#{@total})"
end
set(count) click to toggle source
# File lib/archive/tar/minitar/command.rb, line 205
def set (count)
  if count < 0 || count > @total
    raise "invalid count: #{count} (total: #{@total})"
  end
  @current = count
  show_progress
  @previous = @current
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.