Ruby 2.6.0 リファレンスマニュアル > ライブラリ一覧 > Englishライブラリ > Kernelモジュール > $DEFAULT_INPUT

variable $DEFAULT_INPUT

$DEFAULT_INPUT -> IO[permalink][rdoc] [added by English]

$< の別名

require "English"
while line = $DEFAULT_INPUT.gets
  p line
end
# end of sample.rb

ruby sample.rb < /etc/passwd
# => "hoge:x:500:501::/home/hoge:/bin/bash\n"
     ...