class XtopLoop

XtopLoop: Fetch input from user and respond.

Public Class Methods

exit_xtop() click to toggle source
# File lib/xtop/xtop_loop.rb, line 7
def self.exit_xtop
  close_screen
  exit(0)
end
start(view) { |getch| ... } click to toggle source
# File lib/xtop/xtop_loop.rb, line 12
def self.start(view)
  begin
    Signal.trap("SIGINT") do
      exit(0)
    end

    cbreak

    while true
      view.redraw
      yield(getch)
    end
  ensure
    close_screen
  end
end