Class: LogBench::App::Screen

Inherits:
Object
  • Object
show all
Includes:
Curses
Defined in:
lib/log_bench/app/screen.rb

Constant Summary collapse

HEADER_HEIGHT =

Layout constants

5
PANEL_BORDER_WIDTH =
3
INPUT_TIMEOUT_MS =
200
HEADER_CYAN =

Color pairs

1
DEFAULT_WHITE =
2
SUCCESS_GREEN =

GET requests, 200 status

3
WARNING_YELLOW =

POST requests, warnings

4
INFO_BLUE =

PUT requests

5
ERROR_RED =

DELETE requests, errors

6
BRIGHT_WHITE =
7
BLACK =
8
MAGENTA =
9
SELECTION_HIGHLIGHT =
10

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#detail_winObject

Returns the value of attribute detail_win.



25
26
27
# File 'lib/log_bench/app/screen.rb', line 25

def detail_win
  @detail_win
end

#header_winObject

Returns the value of attribute header_win.



25
26
27
# File 'lib/log_bench/app/screen.rb', line 25

def header_win
  @header_win
end

#log_winObject

Returns the value of attribute log_win.



25
26
27
# File 'lib/log_bench/app/screen.rb', line 25

def log_win
  @log_win
end

#panel_widthObject

Returns the value of attribute panel_width.



25
26
27
# File 'lib/log_bench/app/screen.rb', line 25

def panel_width
  @panel_width
end

Instance Method Details

#cleanupObject



35
36
37
# File 'lib/log_bench/app/screen.rb', line 35

def cleanup
  close_screen
end

#color_pair(n) ⇒ Object



54
55
56
# File 'lib/log_bench/app/screen.rb', line 54

def color_pair(n)
  Curses.color_pair(n)
end

#heightObject



46
47
48
# File 'lib/log_bench/app/screen.rb', line 46

def height
  lines
end

#refresh_allObject



39
40
41
42
43
44
# File 'lib/log_bench/app/screen.rb', line 39

def refresh_all
  header_win.refresh
  log_win.refresh
  detail_win.refresh
  refresh
end

#setupObject



27
28
29
30
31
32
33
# File 'lib/log_bench/app/screen.rb', line 27

def setup
  init_screen
  setup_colors
  clear_screen_immediately
  setup_windows
  turn_text_selection_mode(false)
end

#turn_text_selection_mode(enabled) ⇒ Object



58
59
60
# File 'lib/log_bench/app/screen.rb', line 58

def turn_text_selection_mode(enabled)
  enabled ? mousemask(0) : mousemask(BUTTON1_CLICKED)
end

#widthObject



50
51
52
# File 'lib/log_bench/app/screen.rb', line 50

def width
  cols
end