Name
Readline — GNU readline library interface
Synopsis
The Readline
module provides a interface to the GNU line editing library named
readline.
Required Library
require ‘readline’
Example
require 'readline'
include Readline
line = readline("Prompt> ", true)Module Function
readline(prompt,add_history)Reads one line with line editing. If the add is
true, the line is also added to the history.
Module Methods
Readline::completion_proc=procSpecifies
Procobject to determine completion behavior. Takes input string, and returns completion candidates.Readline::completion_procReturns the completion
Procobject.Readline::completion_case_fold=boolSets whether or not to ignore case on completion.
Readline::completion_case_foldReturns
trueif completion ignores case.Readline::completion_append_character=charSpecifies a character to be appended on completion. If empty string (“”) or nil is specified, nothing is appended.
Readline::completion_append_characterReturns a string containing a character to be appended on completion. Default is a space.
Readline::vi_editing_modeSpecifies vi editing mode.
Readline::emacs_editing_modeSpecifies Emacs editing mode.
Constant
HISTORYThe history buffer; it behaves just like an array.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access