title: Looping through a 2d array in ruby to display it in a table format?
body: <p>How can i represent a 2d array in a table format in the terminal, where it lines up the columns properly just like a table? </p>
  
  <p>so it looks like so:</p>
  
  <pre><code>         1       2       3          4          5
     1 [ Infinity | 40 | 45       | Infinity | Infinity ]
     2 [ Infinity | 20 | 50       | 14       | 20 ]
     3 [ Infinity | 30 | 40       | Infinity | 40 ]
     4 [ Infinity | 28 | Infinity | 6        | 6 ]
     5 [ Infinity | 40 | 80       | 12       | 0 ]
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>[ Infinity,40,45,Infinity,Infinity ]
  [ Infinity,20,50,14,20 ]
  [ Infinity,30,40,Infinity,40 ]
  [ Infinity,28,Infinity,6,6 ]
  [ Infinity,40,80,12,0 ]
  </code></pre>