這是我的哈希(在Json中) 我需要獲取每個「高」值的最大值。例如,在這種情況下是16.94多鍵哈希的最大值
如何在Ruby中得到這個?
我試圖與[]的.max功能,但我不知道來設置「鍵」,其中valutate最大
{
"query": {
"count": 124,
"created": "2012-03-21T20:45:39Z",
"lang": "en-US",
"results": {
"quote": [
{
"date": "2010-03-10",
"Date": "2010-03-10",
"Open": "16.51",
"High": "16.94",
"Low": "16.51",
"Close": "16.79",
"Volume": "33088600",
"Adj_Close": "16.79"
},
{
"date": "2010-03-09",
"Date": "2010-03-09",
"Open": "16.41",
"High": "16.72",
"Low": "16.40",
"Close": "16.53",
"Volume": "20755200",
"Adj_Close": "16.53"
},
{
"date": "2010-03-08",
"Date": "2010-03-08",
"Open": "16.32",
"High": "16.61",
"Low": "16.30",
"Close": "16.52",
"Volume": "30554000",
"Adj_Close": "16.52"
},
{
"date": "2010-03-05",
"Date": "2010-03-05",
"Open": "15.89",
"High": "16.38",
"Low": "15.89",
"Close": "16.06",
"Volume": "21415000",
"Adj_Close": "16.06"
}
我愛Ruby! :) – sparkle 2012-03-21 21:07:16