Skip to content
This repository
Browse code

Refactor RoutesReloader a bit to avoid creating extra hash objects

  • Loading branch information...
commit 72a2edd8c308cf63237b9e010f6595fd3ad08463 1 parent af024f4
Carlos Antonio da Silva authored
5  railties/lib/rails/application/routes_reloader.rb
@@ -24,12 +24,11 @@ def reload!
24 24
 
25 25
       def updater
26 26
         @updater ||= begin
27  
-          dirs = @external_routes.inject({}) do |hash, dir|
28  
-            hash.merge(dir.to_s => ["rb"])
  27
+          dirs = @external_routes.each_with_object({}) do |dir, hash|
  28
+            hash[dir.to_s] = %w(rb)
29 29
           end
30 30
 
31 31
           updater = ActiveSupport::FileUpdateChecker.new(paths, dirs) { reload! }
32  
-
33 32
           updater.execute
34 33
           updater
35 34
         end

0 notes on commit 72a2edd

Please sign in to comment.
Something went wrong with that request. Please try again.