aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/extend/pathname.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 253380982..fd97b2a35 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -93,12 +93,9 @@ class Pathname
open("w", *open_args) { |f| f.write(content) }
end
- # Note: Ruby 2.1+ has Pathname#write and Pathname#binwrite
- def binwrite binary_content
- raise "Will not overwrite #{to_s}" if exist?
- dirname.mkpath
- File.open(self, 'wb') {|f| f.write binary_content }
- end
+ def binwrite(contents, *open_args)
+ open("wb", *open_args) { |f| f.write(contents) }
+ end unless method_defined?(:binwrite)
# NOTE always overwrites
def atomic_write content