public
Fork of cainlevy/benchmarkforrails
Description: configurable benchmarking for rails -- Updated for Edge Rails 2.1+
Clone URL: git://github.com/DrMark/benchmarkforrails.git
updating for edge Rails 2.1+
DrMark (author)
Thu Jun 26 23:41:25 -0700 2008
commit  91dde203db14bbed3f90a67dc127f8aab51e68c1
tree    9132b6de794acf404de1031b2eb1dc801a136e7b
parent  4a818828ee4c1684ea7e0aa0ed94104b1bad0f64
...
19
20
21
22
 
23
24
25
...
19
20
21
 
22
23
24
25
0
@@ -19,7 +19,7 @@ module BenchmarkForRails
0
     # * method: the name of the method to be benchmarked
0
     # * instance: whether the method is an instance method or not
0
     def watch(name, obj, method, instance = true)
0
- rewatchable(name, obj.to_s, method, instance) if Dependencies.will_unload?(obj)
1
+ rewatchable(name, obj.to_s, method, instance) if ActiveSupport::Dependencies.will_unload?(obj)
0
 
0
       obj.class_eval <<-EOL, __FILE__, __LINE__
0
         #{"class << self" unless instance}
...
19
20
21
22
23
24
25
26
 
 
 
 
 
 
 
27
 
28
29
30
31
32
33
34
35
 
36
37
 
38
39
40
...
19
20
21
 
 
 
 
 
22
23
24
25
26
27
28
29
30
31
 
32
33
 
34
35
 
36
37
 
38
39
40
41
0
@@ -19,22 +19,23 @@ module BenchmarkForRails
0
 end
0
 
0
 # hook into dependency unloading
0
-module Dependencies
0
- class << self
0
- def clear_with_rewatching(*args, &block)
0
- returning clear_without_rewatching(*args, &block) do
0
- BenchmarkForRails.rewatch!
0
+module ActiveSupport
0
+ module Dependencies
0
+ class << self
0
+ def clear_with_rewatching(*args, &block)
0
+ returning clear_without_rewatching(*args, &block) do
0
+ BenchmarkForRails.rewatch!
0
+ end
0
       end
0
+ alias_method_chain :clear, :rewatching
0
     end
0
- alias_method_chain :clear, :rewatching
0
   end
0
 end
0
-
0
 # patch a typo bug in Dependencies
0
 begin
0
- Dependencies.will_unload?(Array) # some already-loaded constant
0
+ ActiveSupport::Dependencies.will_unload?(Array) # some already-loaded constant
0
 rescue NameError
0
- Dependencies.module_eval do
0
+ ActiveSupport::Dependencies.module_eval do
0
     def will_unload?(const_desc)
0
       # this was autoloaded?(desc), which is an undefined variable
0
       autoloaded?(const_desc) ||

Comments

  • cainlevy Fri Jun 27 13:16:38 -0700 2008 at lib/benchmark_for_rails.rb L23

    I like this namespacing move on their part. Maybe B4R should alias Dependencies into ActiveSupport for all versions of Rails <= 2.1, and always reference it there? That would keep backwards compatibility, I think.