Module: Tins::Complete
- Included in:
- Object
- Defined in:
- lib/tins/complete.rb
Overview
A module that provides completion functionality for objects.
Constant Summary collapse
- @@sync =
Sync.new
Class Method Summary collapse
-
.complete(prompt: '', add_hist: false) {|String| ... } ⇒ String
The complete method reads a line of input from the user with optional prompt and history support.
Instance Method Summary collapse
-
#complete(prompt: '', add_hist: false) {|String| ... } ⇒ String
private
The complete method reads a line of input from the user with optional prompt and history support.
Class Method Details
.complete(prompt: '', add_hist: false) {|String| ... } ⇒ String
The complete method reads a line of input from the user with optional prompt and history support.
history
25 26 27 28 29 30 31 32 |
# File 'lib/tins/complete.rb', line 25 def complete(prompt: '', add_hist: false, &block) @@sync.synchronize do Readline.completion_proc = block Readline.input = STDIN Readline.output = STDOUT Readline.readline(prompt, add_hist) end end |
Instance Method Details
#complete(prompt: '', add_hist: false) {|String| ... } ⇒ String (private)
The complete method reads a line of input from the user with optional prompt and history support.
history
25 26 27 28 29 30 31 32 |
# File 'lib/tins/complete.rb', line 25 def complete(prompt: '', add_hist: false, &block) @@sync.synchronize do Readline.completion_proc = block Readline.input = STDIN Readline.output = STDOUT Readline.readline(prompt, add_hist) end end |