Sha256: 9863a14e0fb27f8b893ffb3b52fc9e1a280292f453869d02b0de6bd5a22ae3d3

Contents?: true

Size: 490 Bytes

Versions: 7

Compression:

Stored size: 490 Bytes

Contents

== Array#product

  require 'facets/array/product'

single argument

  r = [1,2,3].product([4,5,6])
  x = [[1, 4],[1, 5],[1, 6],[2, 4],[2, 5],[2, 6],[3, 4],[3, 5],[3, 6]]
  r.assert == x

multiple arguments

  a = %w|a b|
  b = %w|a x|
  c = %w|x y|
  r = a.product(b, c)
  x = [ ["a", "a", "x"],
        ["a", "a", "y"],
        ["a", "x", "x"],
        ["a", "x", "y"],
        ["b", "a", "x"],
        ["b", "a", "y"],
        ["b", "x", "x"],
        ["b", "x", "y"] ]
  r.assert == x

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
facets-3.0.0 demo/core/array/product.rdoc
facets-2.9.3 qed/core/array/product.rdoc
facets-2.9.2 qed/core/array/product.rdoc
facets-2.9.1 qed/core/array/product.rdoc
facets-2.9.0 qed/core/array/product.rdoc
facets-2.9.0.pre.2 qed/core/array/product.rdoc
facets-2.9.0.pre.1 qed/core/array/product.rdoc