AR DUMP HER!!!!!

Project Full Name: ArDumper Submitted Description: ArDumper is designed to dump volume rails activerecord data to a file in chunks.

Options include:

  • paginating arguments to control page size

  • finder options to provide control over the data set dumped

  • field/method options provide control over content dumped for each activerecord.

Current supported file types are csv, xml and yaml.

Other features include:

  • send_file support for ActiveController to send the file

#############################################################################

 ArDumper
############################################################################ 
 Formats ActiveRecord data in chunks and dumps it to a file, temporary file, or string. Specify the page_size used to paginate
 records and flush files. 
 SPECIFY OUTPUT
 * <tt>:filename</tt> - the name of the file to create. By default will create a file based on the timestamp.
 * <tt>:file_extension</tt> - appends file extension unless one exists in file name
 * <tt>:only</tt> - a list of the attributes to be included. By default, all column_names are used.
 * <tt>:except</tt> - a list of the attributes to be excluded. By default, all column_names are used. This option is not available if +:only+ is used
 * <tt>:methods</tt> - a list of the methods to be called on the object
 * <tt>:procs</tt> - hash of header name to Proc object 
 FINDER METHODS
 * <tt>:find</tt> - a map of the finder options passed to find. For example, + {:conditions => ['hairy = ?', 'of course'], :include => :rodents} +
 FORMAT HEADER
 * <tt>:header</tt> - when a hash is specified, maps the field name to the header name. For example {:a => 'COL A', :b => 'COL B'} would print 'COL A', 'COL B'
   when an array is specified uses this instead of the fields
   when true or by default prints the fields
   when false does not include a header      
 * <tt>:text_format</tt> - a string method such as :titleize, :dasherize, :underscore to format the on all the headers. If an attribute is :email_address and 
            :titleize is chosen, then the Header value is "Email Address"
 * <tt>:root</tt> In xml, this is the name of the highest level list object. The plural of the class name is the default. For yml, this is the base name of the
   the objects. Each record will be root_id. For example, contact_2348
 FILENAME AND TARGET
 <tt> :target_type</tt> The target_type for the data. Defaults to +:file+. 
   * :string prints to string. Do not use with large data sets
   * :tmp_file. Use a temporary file that is destroyed when the process exists
   * :file. Use a standard file
 <tt> :filename </tt> basename of the file. Defaults to random time based string for non-temporary files
 <tt> :file_extension </tt> Extension (suffix) like .csv, .xml. Added only if the basename has no suffix. 
  :file_extension is only available when +:target_type_type => :file+
 <tt> :file_path </tt> path or directory of the file. Defaults to dumper_file_path or temporary directories                        
 Specify which attributes to include and exclude
   Girlfriend.dumper :yml, :only => [:name, :rating]
   Boyfriend.dumper :csv, :except => [:personality]
 Use :methods to include methods on the record
   BigOle.dumper :csv, :methods => [:age, :favorite_food]
   Output..
   ..other attributes.., 25, doughnuts
 To call any Proc's on the object(s) use :procs. All options are availabe to the process including
   record - the active record
   result_set - the current result set
   counter - the number of the record
   page_num - the page number
   target - the file/string target  
   proc = Proc.new { |options| options[:record].rating > 8 ? 'HIGHLY RATED' ? 'AVERAGE'}
   Girlfriend.dumper :xml, :procs => {'my_rating' => proc}
   <girlfriend>
       ... other attributes and methods ...
     <my_rating>HIGHLY RATED</my_rating>
   </girlfriend>