class PrimeTest::ProductMatrix

Attributes

list[R]

Public Class Methods

new(list) click to toggle source
# File lib/prime_test/product_matrix.rb, line 6
def initialize(list)
  @list = list.map(&:to_i)
end

Public Instance Methods

map() click to toggle source
# File lib/prime_test/product_matrix.rb, line 10
def map
  rows = [[nil] + list]
  list.each do |i|
    rows << [i] + list.collect {|x| x * i}
  end
  rows
end