Object
Equivalent to +File::open+ with an associated block, but moves any existing file with the same name to the side first.
# File lib/inline.rb, line 840
840: def self.write_with_backup(path) # returns true if file already existed
841:
842: # move previous version to the side if it exists
843: renamed = false
844: if test ff, path then
845: renamed = true
846: File.rename path, path + ".old"
847: end
848:
849: File.open(path, "w") do |io|
850: yield(io)
851: end
852:
853: return renamed
854: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.