Я думаю, вы могли бы использовать что-то вроде этого:
# Initialize the input queue. This is where the user-created info will be stored
$QUEUE = []
def pending
old = $QUEUE
$QUEUE = []
old
end
t = Thread.new do
loop do
# Ask the user for something
print "Enter info here: "
# Read information in
$QUEUE << gets.chomp
end
end
# Example code utilizing this; you can do whatever you like with the queue
2.times do
sleep 5
# Print the list out
puts "\nYou entered: \n" << pending.join("\n")
end