Skip to content

Commit

Permalink
Require ruby-prof >= 0.7.3. Tighten rescue clause.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Feb 7, 2009
1 parent f44cece commit 79bf959
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions init.rb
@@ -1,14 +1,17 @@
begin
require 'action_profiler'
class ActionController::Base
include ActionController::ActionProfiler
logger.info "Action profiling enabled. Add around_filter :action_profiler to ApplicationController then append ?profile=process_time to any URL to profile the page load and download a calltree file. Open it with kcachegrind."
end
rescue LoadError
gem 'ruby-prof', '>= 0.7.3'
rescue Gem::LoadError
class ActionController::Base
def action_profiler(*args)
logger.info "`gem install ruby-prof` to enable action profiling."
yield
end
logger.info "Action profiling disabled. `gem install ruby-prof` to enable."
end
else
require 'action_profiler'
class ActionController::Base
include ActionController::ActionProfiler
logger.info "Action profiling enabled. Add around_filter :action_profiler to ApplicationController then append ?profile=process_time to any URL to profile the page load and download a calltree file. Open it with kcachegrind."
end
end

0 comments on commit 79bf959

Please sign in to comment.