Skip to content

Commit e2781c2

Browse files
committed
Use filter_map for template_glob
1 parent 43ec4ce commit e2781c2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

actionview/lib/action_view/template/resolver.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,12 @@ def template_glob(glob)
324324
query = File.join(escape_entry(@path), glob)
325325
path_with_slash = File.join(@path, "")
326326

327-
Dir.glob(query).reject do |filename|
328-
File.directory?(filename)
329-
end.map do |filename|
330-
File.expand_path(filename)
331-
end.select do |filename|
332-
filename.start_with?(path_with_slash)
327+
Dir.glob(query).filter_map do |filename|
328+
filename = File.expand_path(filename)
329+
next if File.directory?(filename)
330+
next unless filename.start_with?(path_with_slash)
331+
332+
filename
333333
end
334334
end
335335

0 commit comments

Comments
 (0)