Something like this?

irb(main):007:0> while (!(input=$stdin.readline.chomp).length.zero?)
irb(main):008:1>   puts input
irb(main):009:1> end
Hello
Hello
World
World

=> nil