Method: Enumerable#split_after
- Defined in:
- lib/upm/core_ext.rb
#split_after(matcher = nil, options = {}, &block) ⇒ Object
Split the array into chunks, cutting between the matched element and the next element.
Example:
[1,2,3,4].split_after{|e| e == 3 } #=> [ [1,2,3], [4] ]
124 125 126 127 128 |
# File 'lib/upm/core_ext.rb', line 124 def split_after(matcher=nil, ={}, &block) [:after] ||= true [:include_boundary] ||= true split_at(matcher, , &block) end |