diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-08-25 22:01:02 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-08-25 22:01:02 -0700 |
commit | 4bcd64c9e93af2f13dc7309cd76bb764e4d7d23d (patch) | |
tree | 946767471cef142651e38f9472c60fd9964040e5 /activesupport/lib/active_support/testing/performance.rb | |
parent | a445cdd8840c4e99c40c6d5b15ab380d39a56be3 (diff) | |
download | rails-4bcd64c9e93af2f13dc7309cd76bb764e4d7d23d.tar.gz rails-4bcd64c9e93af2f13dc7309cd76bb764e4d7d23d.tar.bz2 rails-4bcd64c9e93af2f13dc7309cd76bb764e4d7d23d.zip |
Ruby 1.9 compat: switch profile_options to superclass_delegating_accessor
Diffstat (limited to 'activesupport/lib/active_support/testing/performance.rb')
-rw-r--r-- | activesupport/lib/active_support/testing/performance.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/testing/performance.rb b/activesupport/lib/active_support/testing/performance.rb index 3ad7289571..f996c40793 100644 --- a/activesupport/lib/active_support/testing/performance.rb +++ b/activesupport/lib/active_support/testing/performance.rb @@ -17,14 +17,14 @@ module ActiveSupport else { :benchmark => false, :runs => 1, - :min_percent => 0.02, + :min_percent => 0.01, :metrics => [:process_time, :memory, :objects], :formats => [:flat, :graph_html, :call_tree], :output => 'tmp/performance' } - end + end.freeze def self.included(base) - base.class_inheritable_hash :profile_options + base.superclass_delegating_accessor :profile_options base.profile_options = DEFAULTS end @@ -34,16 +34,17 @@ module ActiveSupport def run(result) return if method_name =~ /^default_test$/ - self.profile_options ||= DEFAULTS yield(self.class::STARTED, name) @_result = result run_warmup - profile_options[:metrics].each do |metric_name| - if klass = Metrics[metric_name.to_sym] - run_profile(klass.new) - result.add_run + if profile_options && metrics = profile_options[:metrics] + metrics.each do |metric_name| + if klass = Metrics[metric_name.to_sym] + run_profile(klass.new) + result.add_run + end end end |