Method: Enumerable#bisect
- Defined in:
- lib/webget_ramp/enumerable.rb
#bisect ⇒ Object
enum.bisect {|obj| block} => array of positives, array of negatives Returns two arrays: the first contains the elements for which block is true, the second contains the elements for which block is false or nil.
250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/webget_ramp/enumerable.rb', line 250 def bisect a=[] b=[] each{|x| if yield(x) a << x else b << x end } return a,b end |