Permalink
Browse files

just use map and case / when rather than modifying the iterating array

  • Loading branch information...
1 parent 7cd3772 commit 26e53a16c4efd479a9bb89202b3e1536e76158b9 @tenderlove tenderlove committed Aug 9, 2011
Showing with 8 additions and 5 deletions.
  1. +8 −5 actionpack/lib/action_view/path_set.rb
@@ -69,13 +69,16 @@ def exists?(path, prefixes, *args)
find_all(path, prefixes, *args).any?
end
- protected
+ private
def typecast(paths)
- paths.each_with_index do |path, i|
- path = path.to_s if path.is_a?(Pathname)
- next unless path.is_a?(String)
- paths[i] = OptimizedFileSystemResolver.new(path)
+ paths.map do |path|
+ case path
+ when Pathname, String
+ OptimizedFileSystemResolver.new path.to_s
+ else
+ path
+ end
end
end
end

0 comments on commit 26e53a1

Please sign in to comment.