class Dmatrix::Matrix

Constants

Aspect
Combination

Attributes

input[R]

Public Class Methods

new(input) click to toggle source
# File lib/dmatrix/matrix.rb, line 3
def initialize(input)
  @input = input
end

Public Instance Methods

combinations() click to toggle source
# File lib/dmatrix/matrix.rb, line 7
def combinations
  dimensions = []

  input.each do |type, dimension_group|
    dimension_group.each do |(name, values)|
      dimensions << values.map { |value| Aspect.new(type, name, value) }
    end
  end

  dimensions.first.product(*dimensions.drop(1)).map do |aspects|
    Combination.new(aspects)
  end
end