title: formatting using table print gem using Ruby
body: <p>The output of my Json file is hash. I'm iterating over each line and using the tp gem to format it. My question is how do I format the width so that all my data is displayed neatly in the terminal. </p>
  
  <p>I assume that it isn't formatting neatly because of the array within the hash.   </p>
  
  <pre><code> File.open("output.json", 'a+') do |file|
        1       data = { time_format: time_format, purchase: @purchase, quantity: @quantity, retail_price: @retail_price, purchasing_price: @purchasing_price }
        0       file.puts data.to_json                                                                                                                                         
        1     end  
  transaction = File.open('output.json', 'a+').each do |line| 
             @transaction = JSON.parse(line)  
             if @transaction["time_format"].include?(review_date) 
  
             end     
           end       
           tp report
  
  
  
  TIME_FORMAT      | PURCHASE | QUANTITY | RETAIL_PRICE | PURCHASING_PRICE
  -----------------|----------|----------|--------------|-----------------
  11/23/2013 08:07 | ["lig... | [1]      | [5.0]        | [3.0]           
  11/23/2013 08:08 | ["lig... | [1]      | [5.0]        | [3.0]           
  11/23/2013 08:08 | ["lig... | [1, 1... | [5.0, 7.5... | [3.0, 4.0, 5....
  11/23/2013 08:12 | ["lig... | [1]      | [5.0]        | [3.0]           
  11/23/2013 08:13 | ["lig... | [1]      | [5.0]        | [3.0]           
  11/23/2013 08:18 | ["lig... | [1]      | [5.0]        | [3.0]           
  </code></pre>
  
  <p>Edit: The gem is called <a href="http://tableprintgem.com/" rel="nofollow">Table Print</a></p>