1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

stop using send so that method privacy is respected and we get a small

perf increase
This commit is contained in:
Aaron Patterson 2013-10-22 10:14:01 -07:00
parent 5ad34a8d8d
commit 2dc889401c

View file

@ -81,29 +81,29 @@ module Rails
end end
def autoload_once def autoload_once
filter_by(:autoload_once?) filter_by { |p| p.autoload_once? }
end end
def eager_load def eager_load
filter_by(:eager_load?) filter_by { |p| p.eager_load? }
end end
def autoload_paths def autoload_paths
filter_by(:autoload?) filter_by { |p| p.autoload? }
end end
def load_paths def load_paths
filter_by(:load_path?) filter_by { |p| p.load_path? }
end end
protected protected
def filter_by(constraint) def filter_by
all = [] all = []
all_paths.each do |path| all_paths.each do |path|
if path.send(constraint) if yield(path)
paths = path.existent 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) all.concat(paths)
end end
end end