Вы можете повторно захватывать вводимые пользователем данные, добавляя вводимые пользователем данные в переменную извне l oop:
# main.rb
inputs = []
until inputs.size >= 6
puts "Please input a value or leave blank to exit"
input = gets.chomp
break if input == ""
inputs << input
end
puts "You have input the following: #{inputs.inspect}"
$ ruby main.rb
Please input a value or leave blank to exit
1
Please input a value or leave blank to exit
2
Please input a value or leave blank to exit
3
Please input a value or leave blank to exit
4
Please input a value or leave blank to exit
5
Please input a value or leave blank to exit
6
You have input the following: ["1", "2", "3", "4", "5", "6"]
$ ruby main.rb
Please input a value or leave blank to exit
1
Please input a value or leave blank to exit
2
Please input a value or leave blank to exit
You have input the following: ["1", "2"]