From: "mame (Yusuke Endoh)" Date: 2012-11-24T11:18:35+09:00 Subject: [ruby-core:49971] [ruby-trunk - Feature #6811][Assigned] File, Dir and FileUtils should have bang-versions of singleton methods that fails silently Issue #6811 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to matz (Yukihiro Matsumoto) Target version set to next minor ---------------------------------------- Feature #6811: File, Dir and FileUtils should have bang-versions of singleton methods that fails silently https://bugs.ruby-lang.org/issues/6811#change-33737 Author: prijutme4ty (Ilya Vorontsov) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: next minor 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 -- http://bugs.ruby-lang.org/