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

[ruby/fileutils] Reduce iteration through list for :mkdir_p

By calling the instruction to `list.map` within `list.each` itself.
https://github.com/ruby/fileutils/commit/e690eec937
This commit is contained in:
Ashwin Maroli 2020-09-10 23:28:35 +05:30 committed by Hiroshi SHIBATA
parent 026ba68c10
commit 3dd9e12b51

View file

@ -208,7 +208,9 @@ module FileUtils
fu_output_message "mkdir -p #{mode ? ('-m %03o ' % mode) : ''}#{list.join ' '}" if verbose
return *list if noop
list.map {|path| remove_trailing_slash(path)}.each do |path|
list.each do |item|
path = remove_trailing_slash(item)
# optimize for the most common case
begin
fu_mkdir path, mode