On Mar 7, 2014, at 10:12 PM, tamouse pontiki [email protected]
wouldn’t mind writing it down, but never seem to get around to it. If
the older ruby bloggers aren’t anymore, maybe more of us should take
it up? (I’m probably age-wise older than many of them, but still
I should start writing something once a week about Ruby. I love the
language and community, and I enjoy using it. As for older, I suspect I
too am on the “to grave” side of the “from cradle to grave” curve.
This week I used Array#product at work, and that saved me a lot of time.
I’ll blog about that at http://www.stok.ca/blog/
Hope this helps,
 pry(main)> ? Array#product
From: array.c (C Method):
Number of lines: 14
Returns an array of all combinations of elements from all arrays.
The length of the returned array is the product of the length of self
the argument arrays.
If given a block, #product will yield all combinations and return self
[1,2,3].product([4,5]) #=> [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]
[1,2].product([1,2]) #=> [[1,1],[1,2],[2,1],[2,2]]
[1,2].product([3,4],[5,6]) #=> [[1,3,5],[1,3,6],[1,4,5],[1,4,6],
[1,2].product() #=> [,]
[1,2].product() #=> 
Mike S. [email protected]
The “`Stok’ disclaimers” apply.