class Screen

Constants

COL_OFFSET
HOSTNAME_WIDTH
LETF_OFFSET
RESULT_WIDTH
RIGHT_OFFSET
TIME_LOW
TOP_OFFSET

Attributes

lines[RW]

Public Class Methods

new() click to toggle source
# File lib/pingman/screen.rb, line 17
def initialize
  init_screen
  start_color
  Curses.init_pair 1, COLOR_WHITE, COLOR_GREEN
  Curses.init_pair 2, COLOR_WHITE, COLOR_RED
  curs_set 0
  noecho
  sleep 0.05
  @lines = []
  @current_cols = cols
  @hostname = Socket.gethostname
  @hostaddr = Socket.getaddrinfo(Socket::gethostname, nil, Socket::AF_INET)[0][3]
  update
end

Public Instance Methods

print_header(line_num) click to toggle source
print_line(line) click to toggle source
print_lines() click to toggle source
print_time(line_num) click to toggle source
update() click to toggle source
# File lib/pingman/screen.rb, line 132
def update
  clear
  @lines_low = print_header(TOP_OFFSET)
  print_lines
  refresh
end
update_line(line) click to toggle source
# File lib/pingman/screen.rb, line 139
def update_line(line)
  if @current_cols != cols
    @current_cols = cols
    update
  end
  print_line line
  print_time TIME_LOW
  refresh
end