>>>>> "K" == Kontra, Gergely <kgergely / mlabdial.hit.bme.hu> writes:

K> userChoice='size'
K> myArray.sort(sortMethods[userChoice])

 Something like this ?

pigeon% cat b.rb
#!/usr/bin/ruby
SM = {
   'name' => proc {|a, b| a <=> b},
   'size' => proc {|a, b| b <=> a}
}
p [1, 3, 2].sort &SM['name']
p [1, 3, 2].sort &SM['size']
pigeon%
 
pigeon% b.rb
[1, 2, 3]
[3, 2, 1]
pigeon% 


Guy Decoux