<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>LICENSE.txt</filename>
    </added>
    <added>
      <filename>README.rdoc</filename>
    </added>
    <added>
      <filename>Rakefile</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -9,10 +9,12 @@ require 'hirb/console'
 
 module Hirb
   class &lt;&lt;self
+    # Default is config/hirb.yml or ~/hirb.yml in that order.
     def config_file
       File.exists?('config/hirb.yml') ? 'config/hirb.yml' : File.expand_path(File.join(&quot;~&quot;,&quot;.hirb.yml&quot;))
     end
 
+    #:enddoc:
     def read_config_file(file=config_file)
       File.exists?(file) ? YAML::load_file(file) : {}
     end</diff>
      <filename>lib/hirb.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,15 @@
 module Hirb
+  # This class is meant to be extended to provide methods for use in a console/irb shell.
+  # For example:
+  #    irb&gt;&gt; extend Hirb::Console
+  #    irb&gt;&gt; view 'some string', :class=&gt;Some::String::Formatter
+  #    irb&gt;&gt; table [[:row1], [:row2]]
   module Console
+    # Renders a table for the given object.
     def table(output, options={})
       Hirb::View.console_render_output(output, options.merge(:class=&gt;&quot;Hirb::Helpers::AutoTable&quot;))
     end
-
+    # Renders any specified view for the given object.
     def view(*args)
       Hirb::View.console_render_output(*args)
     end</diff>
      <filename>lib/hirb/console.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 require 'ostruct'
 
-class Hirb::HashStruct &lt; OpenStruct
+class Hirb::HashStruct &lt; OpenStruct #:nodoc:
   def self.block_to_hash(block=nil)
     config = self.new
     if block</diff>
      <filename>lib/hirb/hash_struct.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 module Hirb
-  module Helpers
+  module Helpers #:nodoc:
   end
 end
 %w{table object_table active_record_table auto_table}.each do |e|</diff>
      <filename>lib/hirb/helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,9 @@
 class Hirb::Helpers::ActiveRecordTable &lt; Hirb::Helpers::ObjectTable
-  # rows are activerecord objects, fields are any record attributes
+  # Rows are Rails' ActiveRecord::Base objects.
+  # Takes same options as Hirb::Helpers::Table.render except as noted below.
+  #
+  # Options:
+  #   :fields- Can be any attribute, column or not. If not given, this defaults to the database table's columns.
   def self.render(rows, options={})
     rows = [rows] unless rows.is_a?(Array)
     options[:fields] ||= </diff>
      <filename>lib/hirb/helpers/active_record_table.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,6 @@
+# Attempts to autodetect the table class the output represents and delegates rendering to it.
 class Hirb::Helpers::AutoTable
+  # Same options as Hirb::Helpers::Table.render.
   def self.render(output, options={})
     klass = if ((output.is_a?(Array) &amp;&amp; output[0].is_a?(ActiveRecord::Base)) or output.is_a?(ActiveRecord::Base) rescue false)
       Hirb::Helpers::ActiveRecordTable</diff>
      <filename>lib/hirb/helpers/auto_table.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,9 @@
 class Hirb::Helpers::ObjectTable &lt; Hirb::Helpers::Table
-  # rows is an array of ruby objects, fields are attributes of the given objects
+  # Rows are any ruby objects. Takes same options as Hirb::Helpers::Table.render except as noted below.
+  #
+  # Options:
+  #   :fields- Methods of the object which are represented as columns in the table. Required option.
+  #     All method values are converted to strings via to_s.
   def self.render(rows, options ={})
     raise(ArgumentError, &quot;Option 'fields' is required.&quot;) unless options[:fields]
     rows = [rows] unless rows.is_a?(Array)</diff>
      <filename>lib/hirb/helpers/object_table.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,16 +1,54 @@
+# Base Table class from which other table classes inherit.
+# By default, a table is constrained to a default width but this can be adjusted
+# via options as well as Hirb:Helpers::Table.max_width.
+# Rows can be an array of arrays or an array of hashes.
+#
+# An array of arrays ie [[1,2], [2,3]], would render:
+#   +---+---+
+#   | 0 | 1 |
+#   +---+---+
+#   | 1 | 2 |
+#   | 2 | 3 |
+#   +---+---+
+#
+# By default, the fields/columns are the numerical indices of the array.
+# 
+# An array of hashes ie [{:age=&gt;10, :weight=&gt;100}, {:age=&gt;80, :weight=&gt;500}], would render:
+#   +-----+--------+
+#   | age | weight |
+#   +-----+--------+
+#   | 10  | 100    |
+#   | 80  | 500    |
+#   +-----+--------+
+#
+# By default, the fields/columns are the keys of the first hash.
+#--
 # derived from http://gist.github.com/72234
-
 class Hirb::Helpers::Table
   DEFAULT_MAX_WIDTH = 150
   class &lt;&lt; self
     attr_accessor :max_width
     
-    def render(*args)
-      new(*args).render
+    # Main method which returns a formatted table.
+    # ==== Options:
+    # [:fields] An array which overrides the default fields and can be used to indicate field order.
+    # [:headers] A hash of fields and their header names. Fields that aren't specified here default to their name.
+    #            This option can also be an array but only for array rows.
+    # [:field_lengths] A hash of fields and their maximum allowed lengths. If a field exceeds it's maximum
+    #                  length than it's truncated and has a ... appended to it. Fields that aren't specified here have no maximum allowed
+    #                  length.
+    # [:max_width] The maximum allowed width of all fields put together. This option is enforced except when the field_lengths option is set.
+    # Examples:
+    #    Hirb::Helpers::Table.render [[1,2], [2,3]]
+    #    Hirb::Helpers::Table.render [[1,2], [2,3]], :field_lengths=&gt;{0=&gt;10}
+    #    Hirb::Helpers::Table.render [{:age=&gt;10, :weight=&gt;100}, {:age=&gt;80, :weight=&gt;500}]
+    #    Hirb::Helpers::Table.render [{:age=&gt;10, :weight=&gt;100}, {:age=&gt;80, :weight=&gt;500}], :headers=&gt;{:weight=&gt;&quot;Weight(lbs)&quot;}
+    def render(rows, options={})
+      new(rows,options).render
     end
   end
   
-  # rows can be an array of hashes
+  #:stopdoc:
   def initialize(rows, options={})
     @options = options
     @fields = options[:fields] || ((rows[0].is_a?(Hash)) ? rows[0].keys.sort {|a,b| a.to_s &lt;=&gt; b.to_s} : 
@@ -89,6 +127,8 @@ class Hirb::Helpers::Table
     end
   end
   
+  # Simple algorithm which given a max width, allows smaller fields to be displayed while
+  # restricting longer fields at a new_long_field_length.
   def restrict_field_lengths(field_lengths, max_width)
     total_length = field_lengths.values.inject {|t,n| t += n}
     if total_length &gt; max_width
@@ -125,4 +165,5 @@ class Hirb::Helpers::Table
   def array_to_indices_hash(array)
     array.inject({}) {|hash,e|  hash[hash.size] = e; hash }
   end
-end
\ No newline at end of file
+  #:startdoc:
+end</diff>
      <filename>lib/hirb/helpers/table.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 module Hirb
-  module ObjectMethods
+  module ObjectMethods #:nodoc:
     def view(*args)
       Hirb::View.console_render_output(*(args.unshift(self)))
     end</diff>
      <filename>lib/hirb/import_object.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,8 @@
 module Hirb
   module Util
     extend self
+    # Returns a constant like const_get() no matter what namespace it's nested in.
+    # Returns nil if the constant is not found.
     def any_const_get(name)
       return name if name.is_a?(Module)
       begin</diff>
      <filename>lib/hirb/util.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,7 +12,7 @@ module Hirb
         load_config(Hirb::HashStruct.block_to_hash(block))
         ::IRB::Irb.class_eval do
           alias :non_hirb_render_output  :output_value
-          def output_value
+          def output_value #:nodoc:
             Hirb::View.render_output(@context.last_value) || non_hirb_render_output
           end
         end
@@ -25,10 +25,13 @@ module Hirb
         end
       end
       
-      # This is the main method of this class. It applies a formatter method or class
-      # to the given object and then renders it (puts by default).
+      # This is the main method of this class. This method searches for the first formatter it can apply
+      # to the object in this order: local block, method option, class option. If a formatter is found it applies it to the object
+      # and returns true. Returns false if no formatter found.
       # ==== Options:
-      # [:]
+      # [:method] Specifies a global (Kernel) method to do the formatting.
+      # [:class] Specifies a class to do the formatting, using its render() class method.
+      # [:options] Options to pass the formatter method or class.
       def render_output(output, options={}, &amp;block)
         if block &amp;&amp; block.arity &gt; 0
           formatted_output = block.call(output)</diff>
      <filename>lib/hirb/view.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-class Hirb::Views::ActiveRecord_Base
+class Hirb::Views::ActiveRecord_Base #:nodoc:
   def self.render(*args)
     Hirb::Helpers::ActiveRecordTable.render(*args)
   end</diff>
      <filename>lib/hirb/views/activerecord_base.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6698a9b98dde5e7f7315ccf197049d828a5a50bf</id>
    </parent>
  </parents>
  <author>
    <name>Gabriel Horner</name>
    <email>gabriel.horner@gmail.com</email>
  </author>
  <url>http://github.com/cldwalker/hirb/commit/35ac7930e298f6d61b469a40247dd1a69a4683f0</url>
  <id>35ac7930e298f6d61b469a40247dd1a69a4683f0</id>
  <committed-date>2009-03-10T21:13:12-07:00</committed-date>
  <authored-date>2009-03-10T16:41:11-07:00</authored-date>
  <message>more docs, rakefile,license + readme</message>
  <tree>d54e44a8bd9da0a35b63b23fc20ffaa79100fe75</tree>
  <committer>
    <name>Gabriel Horner</name>
    <email>gabriel.horner@gmail.com</email>
  </committer>
</commit>
