class ConsoleProgressBar::ProgressBar

Public Class Methods

animator(options = {}) click to toggle source
# File lib/console_progress_bar.rb, line 16
def self.animator(options = {})
  new.animator(options)
end
bar(options = {}) click to toggle source
# File lib/console_progress_bar.rb, line 20
def self.bar(options = {})
  new.bar(options)
end
counter(options = {}) click to toggle source
# File lib/console_progress_bar.rb, line 12
def self.counter(options = {})
  new.counter(options)
end

Public Instance Methods

animator(options = {}) click to toggle source
# File lib/console_progress_bar.rb, line 29
def animator(options = {})
        init_options(options)
        ConsoleProgressBar::Animator.new(@total, @with_elapsed_time, @with_remaining_time, @increment_size)
end
bar(options = {}) click to toggle source
# File lib/console_progress_bar.rb, line 34
def bar(options = {})
        init_options(options)
        ConsoleProgressBar::Bar.new(@total, @with_elapsed_time, @with_remaining_time, @increment_size, @width)
end
counter(options = {}) click to toggle source
# File lib/console_progress_bar.rb, line 24
def counter(options = {})
        init_options(options)
        ConsoleProgressBar::Counter.new(@total, @with_elapsed_time, @with_remaining_time, @increment_size)
end

Private Instance Methods

init_options(options = {}) click to toggle source
# File lib/console_progress_bar.rb, line 40
def init_options(options = {})
        unless options.nil?
                @total = options[:total].nil? ? 100 : options[:total]
                @with_elapsed_time = options[:with_elapsed_time].nil? ? false : options[:with_elapsed_time]
                @with_remaining_time = options[:with_remaining_time].nil? ? false : options[:with_remaining_time]
                @increment_size = options[:increment_size].nil? ? 1 : options[:increment_size]
                @width = options[:width].nil? ? 20 : options[:width]
        end
end