Permalink
Browse files

Refactor RoutesReloader a bit to avoid creating extra hash objects

  • Loading branch information...
1 parent af024f4 commit 72a2edd8c308cf63237b9e010f6595fd3ad08463 @carlosantoniodasilva carlosantoniodasilva committed Apr 28, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 railties/lib/rails/application/routes_reloader.rb
@@ -24,12 +24,11 @@ def reload!
def updater
@updater ||= begin
- dirs = @external_routes.inject({}) do |hash, dir|
- hash.merge(dir.to_s => ["rb"])
+ dirs = @external_routes.each_with_object({}) do |dir, hash|
+ hash[dir.to_s] = %w(rb)
end
updater = ActiveSupport::FileUpdateChecker.new(paths, dirs) { reload! }
-
updater.execute
updater
end

0 comments on commit 72a2edd

Please sign in to comment.