Class: Potty::Surface

Inherits:
Object
  • Object
show all
Defined in:
lib/potty/surface.rb

Overview

Abstract render target. Widgets draw against a Surface (setpos / addstr / attron) and the concrete subclass decides how that reaches the terminal: CursesSurface paints a curses screen; InlineSurface writes ANSI to stdout. The component tree describes what; the surface decides how.

Instance Method Summary collapse

Instance Method Details

#addstr(_str) ⇒ Object

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/potty/surface.rb', line 27

def addstr(_str)
  raise NotImplementedError
end

#attron(_style_or_attr) ⇒ Object

Apply a style around the block’s draws. Accepts a Potty::Style or a raw integer (a legacy curses attribute) — see CursesSurface.



33
34
35
# File 'lib/potty/surface.rb', line 33

def attron(_style_or_attr)
  yield if block_given?
end

#eraseObject

Frame lifecycle: erase the buffer, widgets draw, then present flushes.

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/potty/surface.rb', line 19

def erase
  raise NotImplementedError
end

#finalizeObject



16
# File 'lib/potty/surface.rb', line 16

def finalize; end

#presentObject

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/potty/surface.rb', line 37

def present
  raise NotImplementedError
end

#read_keyObject

One integer key code, or nil if there was no input this cycle.



42
43
44
# File 'lib/potty/surface.rb', line 42

def read_key
  nil
end

#setpos(_row, _col) ⇒ Object

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/potty/surface.rb', line 23

def setpos(_row, _col)
  raise NotImplementedError
end

#sizeObject

rows, cols

of the drawable area.

Raises:

  • (NotImplementedError)


10
11
12
# File 'lib/potty/surface.rb', line 10

def size
  raise NotImplementedError
end

#startObject

Acquire / release the terminal.



15
# File 'lib/potty/surface.rb', line 15

def start; end