I want to make a Array multipled by another Array, and the following
[1, 2, 3] * [4, 5]
then I will want [[1, 4], [1, 5], [2, 4], [2, 5], [3, 4], [3, 5]]
I have the following code snippet to implement this function:
alias_method :orig_multiple, :*
inject() do |product, item|
product.concat(arg.collect do |i|
item.clone << i
It works but seems ugly.
Could anyone please to give me a clue to make it beauty and rubish!
Thx in advance.