Actions
Feature #6811
openFile, Dir and FileUtils should have bang-versions of singleton methods that fails silently
Feature #6811:
File, Dir and FileUtils should have bang-versions of singleton methods that fails silently
Description
I found that often write
Dir.mkdir(folder) unless Dir.exist? folder
and similar code for rm, rm_rf and so on
We can simply make bang-versions like
def Dir.mkdir!(folder, permissions=0744)
Dir.mkdir(folder, permissions) unless Dir.exist? folder
or another alternative Dir.mkdir(folder, permissions) rescue false¶
end
Actions