将队列转换为数组

q = Queue.new
q << 1
q << 2

a = Array.new
a << q.pop until q.empty?

或者一个班轮 :

[].tap { |array| array < queue.pop until queue.empty? }