1
我有一個模型Timer(id:integer, track:string, time_point:integer)
這個問題,我問在計算器關於重組我的數組整數值數組的範圍,並採取了相當不錯的答案(用於steenslag最大的感謝)前:如何從列a中選擇所有值,將它們帶到新數組中?
array = [1,4,10,14,22]
array.unshift(-1)
ranges = array.each_cons(2).map{|a,b| a+1..b} #=>[0..1, 2..4, 5..10, 11..14, 15..22]
array.shift
現在我想應用此解決方案並創建一個包含我所有time_points的整數數組以便進行下一次重組。我怎麼能得到這個數組?
感謝您的幫助
可能重複[如何將單個列的值存入數組](http://stackoverflow.com/questions/9869870/how-to-get-a-single-columns-values-into- an-array) –