我有以下数组
arr = [
{ nbr: "979276030", des: "CONF NO COST 30 Refi Plus <= 105 SM SRVR", status: "2C", milestone: "Processing", dt_time: "03/23/2016 12:00 AM", name: "Brad Pacocha" },
{ nbr: "910482832", des: "CONF NO COST 30 Refi Plus <= 105 SM SRVR", status: "2C", milestone: "Processing", dt_time: "08/23/2015 12:00 AM", name: "Aracely Bogan" },
{ nbr: "819205275", des: "CONF NO COST 30 Refi Plus <= 105 SM SRVR", status: "2C", milestone: "Processing", dt_time: "09/02/2015 12:00 AM", name: "Kelli Moore" },
{ nbr: "755667162", des: "CONF NO COST 30 Refi Plus <= 105 SM SRVR", status: "2C", milestone: "Processing", dt_time: "10/16/2015 12:00 AM", name: "Trace Auer" },
{ nbr: "561189198", des: "CONF NO COST 30 Refi Plus <= 105 SM SRVR", status: "2C", milestone: "Processing", dt_time: "01/11/2016 12:00 AM", name: "Geoffrey Will" },
{ nbr: "429905984", des: "CONF NO COST 30 Refi Plus <= 105 SM SRVR", status: "2C", milestone: "Processing", dt_time: "04/25/2016 12:00 AM", name: "Martine Berge" },
{ nbr: "421919042", des: "CONF NO COST 30 Refi Plus <= 105 SM SRVR", status: "2C", milestone: "Processing", dt_time: "02/26/2016 12:00 AM", name: "Jewel Bailey" },
{ nbr: "274874145", des: "CONF NO COST 30 Refi Plus <= 105 SM SRVR", status: "2C", milestone: "Processing", dt_time: "04/19/2016 12:00 AM", name: "Wendell Tremblay" },
{ nbr: "254548319", des: "CONF NO COST 30 Refi Plus <= 105 SM SRVR", status: "2C", milestone: "Processing", dt_time: "01/16/2016 12:00 AM", name: "Dewitt Ritchie" },
{ nbr: "250154069", des: "CONF NO COST 30 Refi Plus <= 105 SM SRVR", status: "2C", milestone: "Processing", dt_time: "10/12/2015 12:00 AM", name: "Lisette Wehner" }
]
sort_arr = arr.sort_by { |h| h[:des] }
puts arr
puts '*'*100
puts sort_arr
我希望排序后的结果应该与我的源数组相同,因为所有哈希的键都具有相同的值。
但我得到了以下结果:
{:nbr=>"250154069", :des=>"CONF NO COST 30 Refi Plus <= 105 SM SRVR", :status=>"2C", :milestone=>"Processing", :dt_time=>"10/12/2015 12:00 AM", :name=>"Lisette Wehner"}
{:nbr=>"910482832", :des=>"CONF NO COST 30 Refi Plus <= 105 SM SRVR", :status=>"2C", :milestone=>"Processing", :dt_time=>"08/23/2015 12:00 AM", :name=>"Aracely Bogan"}
{:nbr=>"819205275", :des=>"CONF NO COST 30 Refi Plus <= 105 SM SRVR", :status=>"2C", :milestone=>"Processing", :dt_time=>"09/02/2015 12:00 AM", :name=>"Kelli Moore"}
{:nbr=>"755667162", :des=>"CONF NO COST 30 Refi Plus <= 105 SM SRVR", :status=>"2C", :milestone=>"Processing", :dt_time=>"10/16/2015 12:00 AM", :name=>"Trace Auer"}
{:nbr=>"561189198", :des=>"CONF NO COST 30 Refi Plus <= 105 SM SRVR", :status=>"2C", :milestone=>"Processing", :dt_time=>"01/11/2016 12:00 AM", :name=>"Geoffrey Will"}
{:nbr=>"429905984", :des=>"CONF NO COST 30 Refi Plus <= 105 SM SRVR", :status=>"2C", :milestone=>"Processing", :dt_time=>"04/25/2016 12:00 AM", :name=>"Martine Berge"}
{:nbr=>"421919042", :des=>"CONF NO COST 30 Refi Plus <= 105 SM SRVR", :status=>"2C", :milestone=>"Processing", :dt_time=>"02/26/2016 12:00 AM", :name=>"Jewel Bailey"}
{:nbr=>"274874145", :des=>"CONF NO COST 30 Refi Plus <= 105 SM SRVR", :status=>"2C", :milestone=>"Processing", :dt_time=>"04/19/2016 12:00 AM", :name=>"Wendell Tremblay"}
{:nbr=>"254548319", :des=>"CONF NO COST 30 Refi Plus <= 105 SM SRVR", :status=>"2C", :milestone=>"Processing", :dt_time=>"01/16/2016 12:00 AM", :name=>"Dewitt Ritchie"}
{:nbr=>"979276030", :des=>"CONF NO COST 30 Refi Plus <= 105 SM SRVR", :status=>"2C", :milestone=>"Processing", :dt_time=>"03/23/2016 12:00 AM", :name=>"Brad Pacocha"}
第一个和最后一个哈希值被交换了。
这是一个有效的结果吗?为什么会出现这种行为?