Class: Bundler::Thor::LineEditor::Readline

Inherits:
Basic
  • Object
show all
Defined in:
lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb

Defined Under Namespace

Classes: PathCompletion

Instance Attribute Summary

Attributes inherited from Basic

#options, #prompt

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Basic

#initialize

Constructor Details

This class inherits a constructor from Bundler::Thor::LineEditor::Basic

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb', line 4

def self.available?
  begin
    require "readline"
  rescue LoadError
  end

  Object.const_defined?(:Readline)
end

Instance Method Details

#readlineObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb', line 13

def readline
  if echo?
    ::Readline.completion_append_character = nil
    # rb-readline does not allow Readline.completion_proc= to receive nil.
    if complete = completion_proc
      ::Readline.completion_proc = complete
    end
    ::Readline.readline(prompt, add_to_history?)
  else
    super
  end
end