class Bundler::Thor::LineEditor::Readline
Public Class Methods
# File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 9 def self.available? Object.const_defined?(:Readline) end
Public Instance Methods
# File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 13
def readline
if echo?
::Readline.completion_append_character = nil
# Ruby 1.8.7 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 Calls superclass method
Bundler::Thor::LineEditor::Basic#readline Private Instance Methods
# File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 28 def add_to_history? options.fetch(:add_to_history, true) end
# File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 42 def completion_options options.fetch(:limited_to, []) end
# File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 32
def completion_proc
if use_path_completion?
proc { |text| PathCompletion.new(text).matches }
elsif completion_options.any?
proc do |text|
completion_options.select { |option| option.start_with?(text) }
end
end
end # File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 46 def use_path_completion? options.fetch(:path, false) end
Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.