<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -17,13 +17,14 @@ begin
       strip.option(:format, :alias =&gt; :f, :default =&gt; 'rails')      
       strip.option(:output, :alias =&gt; :o)
       strip.switch(:discard_teaser_lines, :t)
-      strip.switch(:keep_junk_lines, :j)      
+      strip.switch(:keep_junk_lines, :j) 
     end
     
     command_line.option(:format, :alias =&gt; :f, :default =&gt; 'rails')
     command_line.option(:file, :alias =&gt; :e)
     command_line.option(:parse_strategy, :default =&gt; 'assume-correct')
-    
+    command_line.option(:dump)
+          
     command_line.option(:aggregator, :alias =&gt; :a, :multiple =&gt; true)
     command_line.option(:database, :alias =&gt; :d)    
 
@@ -61,6 +62,7 @@ rescue CommandLine::Error =&gt; e
   puts &quot;  --debug                    Print debug information while parsing.&quot;
   puts &quot;  --file &lt;filename&gt;          Output to file.&quot;
   puts &quot;  --output &lt;format&gt;          Output format. Supports 'HTML' and 'FixedWidth' (default)&quot;  
+  puts &quot;  --dump &lt;filename&gt;          Dump the YAML formatted results in the given file&quot;
   puts 
   puts &quot;Examples:&quot;
   puts &quot;  request-log-analyzer development.log&quot;</diff>
      <filename>bin/request-log-analyzer</filename>
    </modified>
    <modified>
      <diff>@@ -90,6 +90,20 @@ module RequestLogAnalyzer::Aggregator
     # Call finalize on all trackers.
     def finalize
       @trackers.each { |tracker| tracker.finalize }
+      save_results_dump(options[:dump]) if options[:dump]
+    end
+    
+    def save_results_dump(filename)
+      File.open(filename, 'w') { |file| file.write(to_yaml) }
+    end
+    
+    # Exports all the tracker results to YAML
+    def to_yaml
+      require 'yaml'
+       trackers_export = @trackers.inject({}) do |export, tracker|
+        export[tracker.title] = tracker.to_yaml_object; export
+      end
+      YAML::dump(trackers_export)
     end
        
     # Call report on all trackers.</diff>
      <filename>lib/request_log_analyzer/aggregator/summarizer.rb</filename>
    </modified>
    <modified>
      <diff>@@ -34,6 +34,7 @@ module RequestLogAnalyzer
 
       options[:database] = arguments[:database] if arguments[:database]
       options[:debug]    = arguments[:debug]
+      options[:dump]     = arguments[:dump]
 
       output_class = RequestLogAnalyzer::Output::const_get(arguments[:output])
       if arguments[:file]</diff>
      <filename>lib/request_log_analyzer/controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -79,6 +79,14 @@ module RequestLogAnalyzer::Tracker
       output &lt;&lt; self.inspect
       output &lt;&lt; &quot;\n&quot;  
     end
+    
+    def title
+      self.class.to_s
+    end
+    
+    def to_yaml_object
+      nil
+    end
          
   end 
 end
\ No newline at end of file</diff>
      <filename>lib/request_log_analyzer/tracker.rb</filename>
    </modified>
    <modified>
      <diff>@@ -155,7 +155,6 @@ module RequestLogAnalyzer::Tracker
                     &quot;%0.02fs&quot; % info[:min], &quot;%0.02fs&quot; % info[:max]]
         end        
       end
-
     end
 
     # Generate a request duration report to the given output object
@@ -180,6 +179,15 @@ module RequestLogAnalyzer::Tracker
           raise &quot;Unknown duration report specified: #{report}!&quot;
         end
       end
-    end      
+    end
+    
+    def title
+      options[:title]  || 'Request duration'
+    end
+    
+    def to_yaml_object
+      return nil if @categories.empty?      
+      @categories
+    end
   end
 end</diff>
      <filename>lib/request_log_analyzer/tracker/duration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -57,7 +57,7 @@ module RequestLogAnalyzer::Tracker
     
     # Return the methods sorted by frequency
     def sorted_by_frequency
-      @frequencies.sort { |a, b| b[1] &lt;=&gt; a[1] }
+      Hash[*@frequencies.sort { |a, b| b[1] &lt;=&gt; a[1] }.flatten]
     end
 
     # Generate a HTTP method frequency report to the given output object.
@@ -81,5 +81,14 @@ module RequestLogAnalyzer::Tracker
 
       end
     end
+    
+    def to_yaml_object
+      return nil if @frequencies.empty?
+      @frequencies
+    end
+    
+    def title
+      options[:title] || 'Request frequency'
+    end
   end
 end</diff>
      <filename>lib/request_log_analyzer/tracker/frequency.rb</filename>
    </modified>
    <modified>
      <diff>@@ -73,7 +73,7 @@ module RequestLogAnalyzer::Tracker
     # Any options for the report should have been set during initialize.
     # &lt;tt&gt;output&lt;/tt&gt; The output object
     def report(output)
-      output.title(&quot;Requests graph - average per day per hour&quot;)
+      output.title(title)
     
       if total_requests == 0
         output &lt;&lt; &quot;None found.\n&quot;
@@ -89,5 +89,17 @@ module RequestLogAnalyzer::Tracker
         end
       end
     end
+    
+    def title
+      options[:title] || &quot;Request distribution per hour&quot;
+    end
+    
+    def to_yaml_object
+      yaml_object = {}
+      @request_time_graph.each_with_index do |freq, hour|
+        yaml_object[&quot;#{hour}:00 - #{hour+1}:00&quot;] = freq
+      end
+      yaml_object
+    end
   end
 end</diff>
      <filename>lib/request_log_analyzer/tracker/hourly_spread.rb</filename>
    </modified>
    <modified>
      <diff>@@ -67,5 +67,14 @@ module RequestLogAnalyzer::Tracker
       end
     
     end
+    
+    def title
+      options[:title] || 'Request timespan'
+    end
+    
+    def to_yaml_object
+      { :first =&gt; first_timestamp, :last  =&gt;last_timestamp }
+    end
+    
   end
 end</diff>
      <filename>lib/request_log_analyzer/tracker/timespan.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>955e124f5eea9f3b84b1d996a6ac724e371f889d</id>
    </parent>
  </parents>
  <author>
    <name>Willem van Bergen</name>
    <email>willem@vanbergen.org</email>
  </author>
  <url>http://github.com/wvanbergen/request-log-analyzer/commit/c76652481b649dc394a94985e5a8f48ca2b6313f</url>
  <id>c76652481b649dc394a94985e5a8f48ca2b6313f</id>
  <committed-date>2009-06-22T12:26:39-07:00</committed-date>
  <authored-date>2009-06-22T12:26:39-07:00</authored-date>
  <message>Implemented basic dumping of results to YAML using the --dump command line options. Needs specs.</message>
  <tree>0259b1806be18b2f739fab1b177c573478885915</tree>
  <committer>
    <name>Willem van Bergen</name>
    <email>willem@vanbergen.org</email>
  </committer>
</commit>
