I have an array of hashes with the information below. I am trying to get the largest, smallest, and average for "timeAsleep". I have tried the answers from these questions, but it doesn't seem to work.
Find the largest value for an array of hashes with common keys?
Finding the element of a Ruby array with the maximum value for a particular attribute
rails select maximum value from array of hash
Here is the array of hashes
{"id"=>"1", "userId"=>"1", "day"=>"2015-12-05", "startTime"=>"2015-12-05T07:49:30.000Z", "endTime"=>"2015-12-05T15:56:30.000Z", "tzOffset"=>"-08:00", "source"=>"misfit", "mainSleep"=>true, "timeAsleep"=>478, "timeAwake"=>9, "efficiency"=>0, "timeToFallAsleep"=>0, "timeAfterWakeup"=>0, "numberOfWakeups"=>1, "timeInBed"=>0, "createdAt"=>"2015-12-05T21:59:24.935Z", "updatedAt"=>"2015-12-05T21:59:24.935Z", "humanId"=>"1"}
{"id"=>"2", "userId"=>"2", "day"=>"2015-12-04", "startTime"=>"2015-12-04T07:02:30.000Z", "endTime"=>"2015-12-04T14:59:30.000Z", "tzOffset"=>"-08:00", "source"=>"misfit", "mainSleep"=>true, "timeAsleep"=>471, "timeAwake"=>6, "efficiency"=>0, "timeToFallAsleep"=>0, "timeAfterWakeup"=>0, "numberOfWakeups"=>1, "timeInBed"=>0, "createdAt"=>"2015-12-04T16:41:44.198Z", "updatedAt"=>"2015-12-04T16:41:44.198Z", "humanId"=>"2"}
{"id"=>"3", "userId"=>"3", "day"=>"2015-12-03", "startTime"=>"2015-12-03T06:02:32.000Z", "endTime"=>"2015-12-03T13:38:32.000Z", "tzOffset"=>"-08:00", "source"=>"misfit", "mainSleep"=>true, "timeAsleep"=>434, "timeAwake"=>22, "efficiency"=>0, "timeToFallAsleep"=>0, "timeAfterWakeup"=>0, "numberOfWakeups"=>2, "timeInBed"=>0, "createdAt"=>"2015-12-03T15:35:42.903Z", "updatedAt"=>"2015-12-03T15:35:42.903Z", "humanId"=>"3"}
{"id"=>"4", "userId"=>"4", "day"=>"2015-12-02", "startTime"=>"2015-12-02T09:17:33.000Z", "endTime"=>"2015-12-02T15:27:33.000Z", "tzOffset"=>"-08:00", "source"=>"misfit", "mainSleep"=>true, "timeAsleep"=>370, "timeAwake"=>0, "efficiency"=>0, "timeToFallAsleep"=>0, "timeAfterWakeup"=>0, "numberOfWakeups"=>0, "timeInBed"=>0, "createdAt"=>"2015-12-03T04:00:02.050Z", "updatedAt"=>"2015-12-03T04:00:02.050Z", "humanId"=>"4"}
{"id"=>"5", "userId"=>"5", "day"=>"2015-12-01", "startTime"=>"2015-12-01T05:45:36.000Z", "endTime"=>"2015-12-01T13:50:36.000Z", "tzOffset"=>"-08:00", "source"=>"misfit", "mainSleep"=>true, "timeAsleep"=>485, "timeAwake"=>0, "efficiency"=>0, "timeToFallAsleep"=>0, "timeAfterWakeup"=>0, "numberOfWakeups"=>0, "timeInBed"=>0, "createdAt"=>"2015-12-01T17:50:20.168Z", "updatedAt"=>"2015-12-01T17:50:20.168Z", "humanId"=>"5"}
{"id"=>"6", "userId"=>"6", "day"=>"2015-11-30", "startTime"=>"2015-11-30T05:57:38.000Z", "endTime"=>"2015-11-30T14:23:38.000Z", "tzOffset"=>"-08:00", "source"=>"misfit", "mainSleep"=>true, "timeAsleep"=>499, "timeAwake"=>7, "efficiency"=>0, "timeToFallAsleep"=>0, "timeAfterWakeup"=>0, "numberOfWakeups"=>1, "timeInBed"=>0, "createdAt"=>"2015-11-30T16:18:38.276Z", "updatedAt"=>"2015-11-30T16:18:38.276Z", "humanId"=>"6"}