123456789_123456789_123456789_123456789_123456789_

Class: Bundler::Thor::LineEditor::Basic

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb

Class Attribute Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(prompt, options) ⇒ Basic

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb', line 10

def initialize(prompt, options)
  @prompt = prompt
  @options = options
end

Class Attribute Details

.available?Boolean (readonly)

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb', line 6

def self.available?
  true
end

Instance Attribute Details

#echo?Boolean (readonly, private)

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb', line 32

def echo?
  options.fetch(:echo, true)
end

#options (readonly)

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb', line 4

attr_reader :prompt, :options

#prompt (readonly)

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb', line 4

attr_reader :prompt, :options

Instance Method Details

#get_input (private)

[ GitHub ]

  
# 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

#readline

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb', line 15

def readline
  $stdout.print(prompt)
  get_input
end