<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -42,6 +42,8 @@ module Hirb
     # [:max_width] The maximum allowed width of all fields put together. This option is enforced except when the field_lengths option is set.
     #              This doesn't count field borders as part of the total.
     # [:number]  When set to true, numbers rows by adding a :hirb_number column as the first column. Default is false.
+    # [:change_fields] A hash to change old field names to new field names. This is useful when wanting to change auto-generated keys to
+    #                  more user-friendly names i.e. for array of arrays.
     # [:filters] A hash of fields and the filters that each row in the field must run through. The filter converts the cell's value by applying
     #            a given proc or an array containing a method and optional arguments to it.
     # [:vertical] When set to true, renders a vertical table using Hirb::Helpers::VerticalTable. Default is false.
@@ -64,7 +66,7 @@ module Hirb
   
   #:stopdoc:
   def initialize(rows, options={})
-    @options = {:description=&gt;true, :filters=&gt;{}}.merge(options)
+    @options = {:description=&gt;true, :filters=&gt;{}, :change_fields=&gt;{}}.merge(options)
     @fields = set_fields(rows)
     @rows = setup_rows(rows)
     @headers = @fields.inject({}) {|h,e| h[e] = e.to_s; h}
@@ -79,7 +81,7 @@ module Hirb
   end
 
   def set_fields(rows)
-    if @options[:fields]
+    fields = if @options[:fields]
       @options[:fields].dup
     else
       if rows[0].is_a?(Hash)
@@ -89,16 +91,22 @@ module Hirb
         rows[0].is_a?(Array) ? (0..rows[0].length - 1).to_a : []
       end
     end
+    @options[:change_fields].each do |oldf, newf|
+      (index = fields.index(oldf)) ? fields[index] = newf : fields &lt;&lt; newf
+    end
+    fields
   end
 
   def setup_rows(rows)
-    rows ||= []
-    rows = [rows] unless rows.is_a?(Array)
+    rows = Array(rows)
     if rows[0].is_a?(Array)
       rows = rows.inject([]) {|new_rows, row|
         new_rows &lt;&lt; array_to_indices_hash(row)
       }
     end
+    @options[:change_fields].each do |oldf, newf|
+      rows.each {|e| e[newf] = e.delete(oldf) if e.key?(oldf) }
+    end
     rows = filter_values(rows)
     rows.each_with_index {|e,i| e[:hirb_number] = (i + 1).to_s} if @options[:number]
     methods.grep(/_callback$/).sort.each do |meth|</diff>
      <filename>lib/hirb/helpers/table.rb</filename>
    </modified>
    <modified>
      <diff>@@ -319,6 +319,18 @@ class Hirb::Helpers::TableTest &lt; Test::Unit::TestCase
       table([{:a=&gt;1, :b=&gt;2}, {:a=&gt;3, :c=&gt;4}], :all_fields=&gt;true).should == expected_table
     end
 
+    test &quot;change_fields option renders&quot; do
+      expected_table = &lt;&lt;-TABLE.unindent
+      +------+-------+
+      | name | value |
+      +------+-------+
+      | 1    | 2     |
+      | 2    | 3     |
+      +------+-------+
+      2 rows in set
+      TABLE
+      table([[1,2],[2,3]], :change_fields=&gt;{0=&gt;'name', 1=&gt;'value'}).should == expected_table
+    end
   end
   
   test &quot;table can detect and run callbacks&quot; do</diff>
      <filename>test/table_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c6374e27d762701da50d7f05430c94e9e625727d</id>
    </parent>
  </parents>
  <author>
    <name>Gabriel Horner</name>
    <email>gabriel.horner@gmail.com</email>
  </author>
  <url>http://github.com/cldwalker/hirb/commit/c13cfcff459bf471938b4bcefa17d7c2fd96d6e6</url>
  <id>c13cfcff459bf471938b4bcefa17d7c2fd96d6e6</id>
  <committed-date>2009-11-06T11:46:00-08:00</committed-date>
  <authored-date>2009-11-06T11:46:00-08:00</authored-date>
  <message>added change_fields option to table</message>
  <tree>2cca2ab2ea2380bc8c716b886a6903cc4f995fbe</tree>
  <committer>
    <name>Gabriel Horner</name>
    <email>gabriel.horner@gmail.com</email>
  </committer>
</commit>
