diff options
-rw-r--r-- | railties/lib/rails/paths.rb | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index 88f1dbba05..bfac24d0c3 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -98,17 +98,11 @@ module Rails protected - def filter_by - all = [] - all_paths.each do |path| - if yield(path) - paths = path.existent - paths -= path.children.map { |p| yield(p) ? [] : p.existent }.flatten - all.concat(paths) - end - end - all.uniq! - all + def filter_by(&block) + all_paths.find_all(&block).flat_map { |path| + paths = path.existent + paths - path.children.map { |p| yield(p) ? [] : p.existent }.flatten + }.uniq end end |