Sha256: acd62e43c0ccc3b72914171677f2774732d39f873745445474f019210ec80ece

Contents?: true

Size: 368 Bytes

Versions: 1

Compression:

Stored size: 368 Bytes

Contents

require 'set'

module Clef

  class Matrix < Array

    include Clef::Utils

    def initialize(sequences)
      return unless sequences.is_a?(Array) && sequences.size > 0
      rotate_matrix(sequences, :right)
      map! {|row| row.compact.uniq }
    end

    def to_s
      "[#{map {|row| "(#{row.sort.map {|n| n.to_s}.join(' ')})"}.join(' ')}]"
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
teejayvanslyke-clef-0.0.0 lib/clef/matrix.rb