Class: Kitsune::Kit::Tui::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/kitsune/kit/tui/renderer.rb

Constant Summary collapse

MIN_WIDTH =
70
MIN_HEIGHT =
18

Instance Method Summary collapse

Instance Method Details

#render(state) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/kitsune/kit/tui/renderer.rb', line 10

def render(state)
  width, height = state.terminal_size
  return small_terminal(width, height) if width < MIN_WIDTH || height < MIN_HEIGHT

  body = screen_lines(state, width, height - 4)
  lines = [top_border(state, width), *body, footer(state, width), bottom_border(width)]
  fit(lines, width, height)
end