Sha256: ed830f007c07bd4adb1b2f3b1617873bd256baff36c37a5eea49b0ec066a2175

Contents?: true

Size: 398 Bytes

Versions: 2

Compression:

Stored size: 398 Bytes

Contents

module MultiProgressBar
  class BarRenderer < ProgressBar  #:nodoc:
    attr_writer :title

    def initialize(title, total, width, &block)
      @block = block
      @buffer = StringIO.new
      @width = width
      super(title, total, @buffer)
    end

    def show
      super
      @block.call(@buffer.string)
      @buffer.string = ""
    end

    def get_width
      @width
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
multi_progress_bar-0.1.0 lib/multi_progress_bar/bar_renderer.rb
multi_progress_bar-0.0.0 lib/multi_progress_bar/bar_renderer.rb