Sha256: c94ac32d18e430f4dc0981493cda3e42048988910a2074590276cde1aa9ad357

Contents?: true

Size: 645 Bytes

Versions: 3

Compression:

Stored size: 645 Bytes

Contents

module Rack
  class RubyProf
    def initialize(app)
      @app = app
    end

    def call(env)
      ::RubyProf.start
      result = @app.call(env)
      data = ::RubyProf.stop

      print(data)
      result
    end

    def print
      printers = {::RubyProf::FlatPrinter => 'c:/temp/profile.txt',
                  ::RubyProf::GraphHtmlPrinter => 'c:/temp/profile.html'}

      printers.each do |printer_klass, file_name|
        printer = printer_klass.new(result)
          ::File.open(file_name, 'wb') do |file|
          printer.print(file, :min_percent => 0.00000001 )
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-prof-0.9.2 lib/ruby-prof/rack.rb
ruby-prof-0.9.1 lib/ruby-prof/rack.rb
ruby-prof-0.9.0 lib/ruby-prof/rack.rb