Class: NProgress
- Inherits:
-
Object
- Object
- NProgress
- Defined in:
- lib/ncurses_ui.rb
Instance Attribute Summary collapse
-
#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, width = 0, value = 0, text = "") ⇒ NProgress
constructor
A new instance of NProgress.
- #refresh ⇒ Object
- #resize ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(scr, row, col, color, bar_color, width = 0, value = 0, text = "") ⇒ NProgress
Returns a new instance of NProgress.
269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/ncurses_ui.rb', line 269 def initialize scr, row, col, color, , width=0, value = 0, text = "" @width = width @color = color @bar_color = @row = row @col = col @winfg = Curses::Window.new 1, 1, @row, @col @winbg = Curses::Window.new 1, self.width, @row, @col @value = value @text = text refresh end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
268 269 270 |
# File 'lib/ncurses_ui.rb', line 268 def text @text end |
#value ⇒ Object
Returns the value of attribute value.
267 268 269 |
# File 'lib/ncurses_ui.rb', line 267 def value @value end |
Instance Method Details
#close ⇒ Object
302 303 304 305 |
# File 'lib/ncurses_ui.rb', line 302 def close @winbg.close @winfg.close end |
#refresh ⇒ Object
291 292 293 294 295 296 297 |
# File 'lib/ncurses_ui.rb', line 291 def refresh offset = fgw Nutils.print @winbg, 0, offset, @text[offset..-1], @color Nutils.print @winfg, 0, 0, @text, @bar_color if fgw > 0 @winbg.refresh @winfg.refresh if fgw > 0 end |
#resize ⇒ Object
299 300 |
# File 'lib/ncurses_ui.rb', line 299 def resize end |
#width ⇒ Object
282 283 284 |
# File 'lib/ncurses_ui.rb', line 282 def width [@col + @width, Curses.cols].min - @col end |