2011-07-12 30 views

回答

0

命名示波器可能是你正在尋找的...我認爲rails 3.1還有一些更深入的「where」東西,以及。

1

你可以像linq那樣做類似的東西,無論如何,語法都是不同的。 你會寫這樣的事:

a.select { |i| 
    (do something with item i and decide whether 
    it should be added to the output array 
    or not by returning true or false) 
} 

假設是一個數組,該代碼將返回一個包含通過驗證代碼的元素的數組。

Documentation of the array class