class Bundler::Thor::LineEditor::Basic
Attributes
options[R]
prompt[R]
Public Class Methods
# File lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 6 def self.available? true end
# File lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 10 def initialize(prompt, options) @prompt = prompt @options = options end
Public Instance Methods
# File lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 15 def readline $stdout.print(prompt) get_input end
Private Instance Methods
# File lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 32 def echo? options.fetch(:echo, true) end
# File lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 22
def get_input
if echo?
$stdin.gets
else
# Lazy-load io/console since it is gem-ified as of 2.3
require "io/console" if RUBY_VERSION > "1.9.2"
$stdin.noecho(&:gets)
end
end
Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.