module Rufo::Backport

def self.chunk_while(array)

if it's not available in the current Ruby version
Implement Enumerable#chunk_while
def self.chunk_while(array)
  results = []
  current = []
  first = true
  last = nil
  array.each do |elem|
    if first
      current << elem
      first = false
    else
      if yield(last, elem)
        current << elem
      else
        results << current
        current = [elem]
      end
    end
    last = elem
  end
  results << current unless current.empty?
  results
end