Browse files

do not search through the keys array twice

  • Loading branch information...
1 parent 8b9733d commit f05f7ffb2e7e51d8f7e47df6356094aafba8437a @tenderlove tenderlove committed Oct 22, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 railties/lib/rails/paths.rb
View
5 railties/lib/rails/paths.rb
@@ -124,8 +124,9 @@ def initialize(root, current, paths, options = {})
end
def children
- keys = @root.keys.select { |k| k.include?(@current) }
- keys.delete(@current)
+ keys = @root.keys.find_all { |k|
+ k.start_with?(@current) && k != @current
+ }
@root.values_at(*keys.sort)
end

0 comments on commit f05f7ff

Please sign in to comment.