print "Enter your password: "
pass = STDIN.noecho(&:gets)
puts "Your password is #{pass}!"
OUTPUT:
Enter your password: input.rb:2:in `<main>': undefined method `noecho' for #<IO:<STDIN>> (NoMethodError)
At first
require 'io/console'
later Ruby 1.9.3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With