Skip to content

Commit

Permalink
Allow the :file passed to Controller::build() to be a StringIO (witho…
Browse files Browse the repository at this point in the history
…ut requiring the StringIO extension).
  • Loading branch information
JEG2 committed Sep 28, 2009
1 parent 644b322 commit 53208bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/request_log_analyzer/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def self.build_from_arguments(arguments)
# * <tt>:parse_strategy</tt>
# * <tt>:no_progress</tt>
# * <tt>:output</tt> :fixed_width, :html or Output class. Defaults to fixed width.
# * <tt>:file</tt> Filestring or File
# * <tt>:file</tt> Filestring or File or StringIO
# * <tt>:format</tt> :rails, {:apache => 'FORMATSTRING'}, :merb, etcetera or Format Class. Defaults to :rails.
# * <tt>:source_files</tt> File or STDIN
# * <tt>:after</tt> Drop all requests after this date
Expand Down Expand Up @@ -121,7 +121,7 @@ def self.build(options)
output_amount = options[:report_amount] == 'all' ? :all : options[:report_amount].to_i

if options[:file]
output_object = (options[:file].class == File) ? options[:file] : File.new(options[:file], "w+")
output_object = %w[File StringIO].include?(options[:file].class.name) ? options[:file] : File.new(options[:file], "w+")
output_args = {:width => 80, :color => false, :characters => :ascii, :sort => output_sort, :amount => output_amount }
elsif options[:mail]
output_object = RequestLogAnalyzer::Mailer.new(arguments[:mail])
Expand Down

0 comments on commit 53208bd

Please sign in to comment.