Why can't I use the noecho method method of class IO?

print "Enter your password: "
pass = STDIN.noecho(&:gets)
puts "Your password is #{pass}!"

CONCLUSION:

 Enter your password: input.rb:2:in `<main>': undefined method `noecho' for #<IO:<STDIN>> (NoMethodError)
+5
source share
1 answer

At first

require 'io/console'

later Ruby 1.9.3

+10
source

All Articles