class Bundler::Thor::LineEditor::Basic

属性

options[R]
prompt[R]

公共类方法

available?() 点击切换源代码
# File bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 6
def self.available?
  true
end
new(prompt, options) 点击切换源代码
# File bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 10
def initialize(prompt, options)
  @prompt = prompt
  @options = options
end

公共实例方法

readline() 点击切换源代码
# File bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 15
def readline
  $stdout.print(prompt)
  get_input
end

私有实例方法

echo?() 点击切换源代码
# File bundler/vendor/thor/lib/thor/line_editor/basic.rb, line 32
def echo?
  options.fetch(:echo, true)
end
get_input() 点击切换源代码
# File 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"
    $stdin.noecho(&:gets)
  end
end