Name
Curses — Character-based interface module
Synopsis
The Curses
module
provides an interface to the character-based interface library called
curses
.
Required Library
require ‘curses’
Module Functions
addch(
ch
)
Outputs one character to the screen
addstr(
str
)
Outputs
str
to the screenbeep
Beeps the bell
cbreak
Turns on
cbreak
modenocbreak
Turns off
cbreak
modeclear
Clears the screen
close_screen
Finalizes the
curses
systemcols
Returns the screen width
crmode
Alias to the
cbreak
nocrmode
Alias to the
nocbreak
delch
Deletes a character at the cursor position
deleteln
Deletes a line at the cursor position
doupdate
Updates the screen by queued changes
echo
Turns on echo mode
noecho
Turns off echo mode
flash
Flashes the screen
getch
Reads one character from the keyboard
getstr
Reads a line of string from the keyboard
inch
Reads a character at the cursor position
init_screen
Initializes the
curses
systeminsch(
ch
)
Outputs one character before the cursor
lines
Returns the screen height
nl
Turns on newline mode, which translates the return key into newline (
\n
)nonl
Turns off newline mode
raw
Turns on raw mode
noraw
Turns off raw mode
refresh
Refreshes the screen
setpos(
y
,
x
)
Moves the cursor to the (
y
,x
) positionstandout
Turns on
standout
(highlighting) modestandend
Turn off
standout
modestdscr
Returns the reference to the standard
curses
screen objectungetch(
ch
)
Pushes
ch
back to input buffer
Get Ruby in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.