Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MultiProgressBar::BARS -> MultiProgressBar.bars

  • Loading branch information...
commit 97384e41811d7638ed7cca433f5214027a5bb59c 1 parent c9b57e5
@Peeja authored
View
13 lib/multi_progress_bar.rb
@@ -4,10 +4,11 @@
require 'abstraction'
module MultiProgressBar
- BARS = []
-
class << self
+ attr_reader :bars
+
def start
+ @bars = [].freeze
Ncurses.initscr
@bars_window = Ncurses::WINDOW.new(1, 0, Ncurses.LINES-1, 0)
end
@@ -21,15 +22,15 @@ def width
end
def add_bar(bar)
- BARS << bar
+ @bars += [bar]
- @bars_window.mvwin(Ncurses.LINES-BARS.size, @bars_window.getbegx)
- @bars_window.resize(BARS.size, @bars_window.getmaxx)
+ @bars_window.mvwin(Ncurses.LINES-bars.size, @bars_window.getbegx)
+ @bars_window.resize(bars.size, @bars_window.getmaxx)
@bars_window.refresh
end
def update_bar(bar, rendered_bar)
- @bars_window.move(BARS.index(bar), 0)
+ @bars_window.move(bars.index(bar), 0)
@bars_window.addstr(rendered_bar)
@bars_window.refresh
end
View
2  lib/multi_progress_bar/total_bar.rb
@@ -1,6 +1,6 @@
module MultiProgressBar
class TotalBar < Bar
- def initialize(title, bars = BARS.dup)
+ def initialize(title, bars = MultiProgressBar.bars.dup)
@bars = bars
@bars.each do |bar|
Please sign in to comment.
Something went wrong with that request. Please try again.