Skip to content
Snippets Groups Projects
Commit 10e5fea0 authored by Adam Vandenberg's avatar Adam Vandenberg
Browse files

add Pathname.write_binary

parent 90762c2f
No related branches found
No related tags found
No related merge requests found
......@@ -93,6 +93,12 @@ class Pathname
open("w", *open_args) { |f| f.write(content) }
end
def write_binary binary_content
raise "Will not overwrite #{to_s}" if exist?
dirname.mkpath
File.open(self, 'wb') {|f| f.write binary_content }
end
# NOTE always overwrites
def atomic_write content
require "tempfile"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment