From c7cfdd01c114e103508c435d5e6cfee0703e2e1d Mon Sep 17 00:00:00 2001 From: Diego Carrion Date: Sat, 5 Mar 2011 01:57:25 -0300 Subject: refactored Engine.#find by giving an explicit name to a variable and reducing calls [#6529 state:committed] Signed-off-by: Santiago Pastorino --- railties/lib/rails/engine.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 50bba22a3a..4fc23fe277 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -382,9 +382,9 @@ module Rails # Finds engine with given path def find(path) - path = path.to_s - Rails::Engine::Railties.engines.find { |r| - File.expand_path(r.root.to_s) == File.expand_path(path) + expanded_path = File.expand_path path.to_s + Rails::Engine::Railties.engines.find { |engine| + File.expand_path(engine.root.to_s) == expanded_path } end end -- cgit v1.2.3