Browse files

Install a dummy action_profiler class method if ruby-prof is unavailable

  • Loading branch information...
1 parent 79bf959 commit 8426e82140f9f62c016989da031d76974cfed827 @jeremy jeremy committed Feb 7, 2009
Showing with 7 additions and 2 deletions.
  1. +7 −2 init.rb
View
9 init.rb
@@ -1,11 +1,16 @@
begin
gem 'ruby-prof', '>= 0.7.3'
rescue Gem::LoadError
- class ActionController::Base
+ module MissingActionProfiler
def action_profiler(*args)
logger.info "`gem install ruby-prof` to enable action profiling."
- yield
+ yield if block_given?
end
+ end
+
+ class ActionController::Base
+ extend MissingActionProfiler
+ include MissingActionProfiler
logger.info "Action profiling disabled. `gem install ruby-prof` to enable."
end
else

0 comments on commit 8426e82

Please sign in to comment.