Method: Enumerable#split_before

Defined in:
lib/upm/core_ext.rb

#split_before(matcher = nil, options = {}, &block) ⇒ Object

Split the array into chunks, cutting before each matched element.

Example:

[1,2,3,4].split_before{|e| e == 3 } #=> [ [1,2], [3,4] ]


136
137
138
139
# File 'lib/upm/core_ext.rb', line 136

def split_before(matcher=nil, options={}, &block)
  options[:include_boundary]  ||= true
  split_at(matcher, options, &block)
end