Sha256: 09cd4b3fff22dd1ef724392c897622e6b2f575828cf6ddd07988f1fa6834367b
Contents?: true
Size: 489 Bytes
Versions: 15
Compression:
Stored size: 489 Bytes
Contents
# encoding: UTF-8 module Enumerable def slice_between(&b) Enumerator.new {|y| first = true buf = [] prev = nil self.each {|elt| if first first = false buf << elt prev = elt else if b.call(prev, elt) y << buf buf = [elt] else buf << elt end prev = elt end } if !buf.empty? y << buf end } end end
Version data entries
15 entries across 15 versions & 1 rubygems