Hi,

At Sun, 15 May 2005 06:20:24 +0900,
David Vincelli wrote in [ruby-talk:142655]:
> while (true) do
> puts "Make your selection from the list below: \n\n"
> puts "a) foo\n"
> puts "b) bar\n\n"
> gets
> handle_action($_)
> end

You should alwasy check if get succeeded.

  prompt = <<PROMPT
  Make your selection from the list below: \n
  a) foo
  b) bar

  PROMPT

  while (print(prompt); ans = gets)
    handle_action(ans)
  end

Or even better if you can use readline:

  while ans = readline(prompt)
    handle_action(ans)
  end

> I think it might be better to simply re-open STDIN as if nothing had 
> happened.. is this a good idea and is it possible?

No way to do it.  If you believe STDIN is connected to tty, you
may want to do STDIN.reopen("/dev/tty").

-- 
Nobu Nakada