class Rabbit::PasswordReader

Public Class Methods

new(prompt) click to toggle source
# File lib/rabbit/password-reader.rb, line 19
def initialize(prompt)
  @prompt = prompt
end

Public Instance Methods

read() click to toggle source
# File lib/rabbit/password-reader.rb, line 23
def read
  print(@prompt)
  system("/bin/stty -echo") if $stdin.tty?
  $stdin.gets.chomp
ensure
  if $stdin.tty?
    system("/bin/stty echo")
    puts
  end
end