From 2dc889401c6e922c04b4783d9f0593be98e1499a Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 22 Oct 2013 10:14:01 -0700 Subject: [PATCH] stop using `send` so that method privacy is respected and we get a small perf increase --- railties/lib/rails/paths.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index de6795eda2d5b..88f1dbba05ebb 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -81,29 +81,29 @@ def all_paths end def autoload_once - filter_by(:autoload_once?) + filter_by { |p| p.autoload_once? } end def eager_load - filter_by(:eager_load?) + filter_by { |p| p.eager_load? } end def autoload_paths - filter_by(:autoload?) + filter_by { |p| p.autoload? } end def load_paths - filter_by(:load_path?) + filter_by { |p| p.load_path? } end protected - def filter_by(constraint) + def filter_by all = [] all_paths.each do |path| - if path.send(constraint) + if yield(path) paths = path.existent - paths -= path.children.map { |p| p.send(constraint) ? [] : p.existent }.flatten + paths -= path.children.map { |p| yield(p) ? [] : p.existent }.flatten all.concat(paths) end end