Method: Array#split_when

Defined in:
lib/ruby/jruby_hack.rb

#split_when(&block) ⇒ (Array, Array)

Splits the array into prefix/suffix pair according to the predicate.

Returns:



166
167
168
169
170
# File 'lib/ruby/jruby_hack.rb', line 166

def split_when(&block)
  prefix = take_until(&block)
  suffix = drop(prefix.length)
  return prefix, suffix
end