def to_s
      col_label_sizes = col_labels.collect { |c| c.to_s.size + 2 }
      row_label_size = row_labels.collect { |r| r.to_s.size + 2 }.max

      row_col_sizes = rows.transpose.collect { |r| r.collect { |c| c.to_s.size } } 

      i = -1
      col_sizes = col_label_sizes.collect do |s| 
        i += 1
        [row_col_sizes[i],s].flatten.max + 1
      end

      s = (sprintf("%#{row_label_size}s", " "))
      col_labels.each_with_index { |l,i| s << (sprintf("%#{col_sizes[i]}s", 
                                                       "[#{l}]"))           } 
      s << "\n"

      rows.each_with_index do |row, i|
        s << (sprintf("%#{row_label_size}s", "[#{row_labels[i]}]"))
        row.each_with_index { |c,j| s << (sprintf("%#{col_sizes[j]}s", c)) }
        s << "\n"
      end

      s
    end
def to_s
      col_label_sizes = col_labels.collect { |c| c.to_s.size + 2 }
      row_label_size = row_labels.collect { |r| r.to_s.size + 2 }.max

      row_col_sizes = rows.transpose.collect { |r| r.collect { |c| c.to_s.size } } 

      i = -1
      col_sizes = col_label_sizes.collect do |s| 
        i += 1
        [row_col_sizes[i],s].flatten.max + 1
      end

      s = (sprintf("%
      col_labels.each_with_index { |l,i| s << (sprintf("%
                                                       "[
      s << "\n"

      rows.each_with_index do |row, i|
        s << (sprintf("%
        row.each_with_index { |c,j| s << (sprintf("%
        s << "\n"
      end

      s
    end
def to_s col_label_sizes = col_labels . collect { | c | c . to_s . size + 2 } row_label_size = row_labels . collect { | r | r . to_s . size + 2 } . max row_col_sizes = rows . transpose . collect { | r | r . collect { | c | c . to_s . size } } i = - 1 col_sizes = col_label_sizes . collect do | s | i += 1 [ row_col_sizes [ i ] , s ] . flatten . max + 1 end s = ( sprintf ( "%#{row_label_size}s" , " " ) ) col_labels . each_with_index { | l , i | s << ( sprintf ( "%#{col_sizes[i]}s" , "[#{l}]" ) ) } s << "\n" rows . each_with_index do | row , i | s << ( sprintf ( "%#{row_label_size}s" , "[#{row_labels[i]}]" ) ) row . each_with_index { | c , j | s << ( sprintf ( "%#{col_sizes[j]}s" , c ) ) } s << "\n" end s end
Prints the spread sheet in a matrix with column labels and row labels. If
 no labels are available the column number and row number is printed
Prints the spread sheet in a matrix with column labels and row labels . If no labels are available the column number and row number is printed