thank you, David. it helps me a lot.

> irb(main):003:0> require 'enumerator' 
> => true
> irb(main):004:0> [1,2,3,4,5,6].each_cons(2) {|x| p x }
> [1, 2]
> [2, 3]
> [3, 4]
> [4, 5]
> [5, 6]
> => nil
> irb(main):005:0> [1,2,3,4,5,6].each_cons(3) {|x| p x }
> [1, 2, 3]
> [2, 3, 4]
> [3, 4, 5]
> [4, 5, 6]

this is just one of what i had been seeking in vain for !!

oh .. 'enumerator' .. i should open my eyes wider.
and i found again that it is very valuable to ask before inventing.

/void/3d/universe/milky-way-galaxy/orion-arm/sol-solar-system/3rd-planet/fareast/jp/tky/shigetomi.takuhiko.5618