2011-07-12 29 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