Sha256: 46b302f82e7d6f49a1006aa032f05a8d46dccfb9d453050d6e9f67de6f9ef1f4
Contents?: true
Size: 259 Bytes
Versions: 2
Compression:
Stored size: 259 Bytes
Contents
require "with_last/version" module WithLast class Error < StandardError; end class ::Array def each_with_last each_with_index { |item, index| yield(item, last?(index)) } end def last?(index) size == (index + 1) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
with_last-0.1.1 | lib/with_last.rb |
with_last-0.1.0 | lib/with_last.rb |