I have not heard from the OP for almost 24 hours, so I will post an idea.

a = [3,1,4,1,5,9,2,6,5,3,5,8,9,7,9]

#one-line version
p [].tap{|b| (0...a.size).each{|c| a.each{|d| b << d if a.select{|e|
e<d}.size==c}}}







OP: This uses Array#size, Array#each, and #select. I have not read the book
you are using but I guess you have studied these methods.
I hope it is readable. If there are any problems, you can fix it.

#Expanded version
b = []
(0...a.size).each do |c|
  a.each do |d|
    if a.select{|e| e<d}.size==c
      b << d
    end
  end
end
p b




Harry