我有 php 代码,其中发生排序,如下所示:
j=0;
while(...){
...
$cancel_alarm_trusee[$j]['created'] = alarm['created'];
...
j++;
}
function Compare($a, $b) {
return $a['created'] < $b['created'];
}
usort($cancel_alarm_trusee, 'Compare');
如何在 Ruby 中做到这一点?