ary.combination(n) { |c| block } â aryary.combination(n) â Enumerator
Instance Public methods
When invoked with a block, yields all combinations of length n
of elements from the array and then returns the array itself.
The implementation makes no guarantees about the order in which the
combinations are yielded.
If no block is given, an Enumerator is
returned instead.
Examples:
a = [1, 2, 3, 4]
a.combination(1).to_a #=> [[1],[2],[3],[4]]
a.combination(2).to_