Sha256: 1195c676908d1e6418b82c9583b7203af7c739604b04e94951ed2dc6ac3889d2
Contents?: true
Size: 742 Bytes
Versions: 2
Compression:
Stored size: 742 Bytes
Contents
module Stairs module Util module FileUtils class << self def replace_or_append(pattern, string, filename) if File.exists? filename contents = File.read filename if contents.index pattern contents.sub! pattern, string write contents, filename return end end write_line string, filename end def write_line(string, filename) File.open filename, "a" do |file| file.puts string end end def write(string, filename) File.truncate filename, 0 if File.exists? filename write_line string, filename end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stairs-0.3.0 | lib/stairs/util/file_utils.rb |
stairs-0.2.0 | lib/stairs/util/file_utils.rb |