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 screen

beep

Beeps the bell

cbreak

Turns on cbreak mode

nocbreak

Turns off cbreak mode

clear

Clears the screen

close_screen

Finalizes the curses system

cols

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 system

insch(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) position

standout

Turns on standout (highlighting) mode

standend

Turn off standout mode

stdscr

Returns the reference to the standard curses screen object

ungetch(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.