Class: NProgress
- Inherits:
-
Object
- Object
- NProgress
- Defined in:
- lib/ncurses_ui.rb
Instance Attribute Summary collapse
-
#subvalue ⇒ Object
Returns the value of attribute subvalue.
-
#text ⇒ Object
Returns the value of attribute text.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(scr, row, col, color, bar_color, subbar_color, width = 0, value = 0, subvalue = 0, text = "") ⇒ NProgress
constructor
A new instance of NProgress.
- #refresh ⇒ Object
- #resize ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(scr, row, col, color, bar_color, subbar_color, width = 0, value = 0, subvalue = 0, text = "") ⇒ NProgress
Returns a new instance of NProgress.
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/ncurses_ui.rb', line 342 def initialize scr, row, col, color, , , width=0, value = 0, subvalue = 0, text = "" @width = width @color = color @bar_color = @subbar_color = @row = row @col = col @winfg = Curses::Window.new 1, 1, @row, @col @winsfg = Curses::Window.new 1, 1, @row, @col @winbg = Curses::Window.new 1, self.width, @row, @col @value = value @subvalue = subvalue @text = text refresh end |
Instance Attribute Details
#subvalue ⇒ Object
Returns the value of attribute subvalue.
340 341 342 |
# File 'lib/ncurses_ui.rb', line 340 def subvalue @subvalue end |
#text ⇒ Object
Returns the value of attribute text.
341 342 343 |
# File 'lib/ncurses_ui.rb', line 341 def text @text end |
#value ⇒ Object
Returns the value of attribute value.
340 341 342 |
# File 'lib/ncurses_ui.rb', line 340 def value @value end |
Instance Method Details
#close ⇒ Object
386 387 388 389 390 |
# File 'lib/ncurses_ui.rb', line 386 def close @winbg.close @winsfg.close @winfg.close end |
#refresh ⇒ Object
372 373 374 375 376 377 378 379 380 381 |
# File 'lib/ncurses_ui.rb', line 372 def refresh bgOffset = [fgw, sfgw].max sbOffset = fgw Nutils.print @winbg, 0, bgOffset, @text[bgOffset..-1], @color Nutils.print @winsfg, 0, sbOffset, @text[sbOffset..-1], @subbar_color if sfgw > 0 Nutils.print @winfg, 0, 0, @text, @bar_color if fgw > 0 @winbg.refresh @winsfg.refresh if sfgw > 0 @winfg.refresh if fgw > 0 end |
#resize ⇒ Object
383 384 |
# File 'lib/ncurses_ui.rb', line 383 def resize end |
#width ⇒ Object
358 359 360 |
# File 'lib/ncurses_ui.rb', line 358 def width [@col + @width, Curses.cols].min - @col end |