Heads up: This description was created by AI and might not be 100% accurate.

crossjoin.rb

This Ruby code snippet demonstrates the use of product method to generate the Cartesian product of arrays.

Ruby code snippet

a = ('a'..'c').to_a
#=> ["a", "b", "c"]
b = 2.times.to_a
#=> [0, 1]
c = [{}]
#=> [{}]

a.product(b, c)
#=> 
[["a", 0, {}],
 ["a", 1, {}],
 ["b", 0, {}],
 ["b", 1, {}],
 ["c", 0, {}],
 ["c", 1, {}]]

Executed with Ruby 3.4.5.