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 843 843: def self.write_with_backup(path) # returns true if file already existed 844: 845: # move previous version to the side if it exists 846: renamed = false 847: if test ff, path then 848: renamed = true 849: File.rename path, path + ".old" 850: end 851: 852: File.open(path, "w") do |io| 853: yield(io) 854: end 855: 856: return renamed 857: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.