When I tried to input standard input using gets like when solving an algorithm problem, I got the following error
$ ruby enc_main.rb new Traceback (most recent call last): 2: from enc_main.rb:12:in `<main>' 1: from enc_main.rb:12:in `gets' enc_main.rb:12:in `gets': No such file or directory @ rb_sysopen - new (Errno::ENOENT)
I solved it by using the gets method using $ stdin in the code below.
if ARGV == "new" puts "What's Name?" name = $stdin.gets
$ stdin (Ruby 2.7.0 Reference Manual) Active engineers explain how to use stdin in Ruby [for beginners] | TechAcademy Magazine