class Bundler::Thor::LineEditor::Basic

Attributes

options[R]
prompt[R]

Public Class Methods

available?() click to toggle source
# File lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 6
def self.available?
  true
end
new(prompt, options) click to toggle source
# 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

readline() click to toggle source
# File lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 15
def readline
  $stdout.print(prompt)
  get_input
end

Private Instance Methods

echo?() click to toggle source
# File lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 32
def echo?
  options.fetch(:echo, true)
end
get_input() click to toggle source
# 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