Module: Tins::Complete

Included in:
Object
Defined in:
lib/tins/complete.rb

Constant Summary collapse

@@sync =
Sync.new

Class Method Summary collapse

Class Method Details

.complete(prompt: '', add_hist: false, &block) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/tins/complete.rb', line 9

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