Sha256: f9f6f5a5119dbe8249903ee4530a773dc48b8e81f9f156255d4163df836bcf1e
Contents?: true
Size: 401 Bytes
Versions: 106
Compression:
Stored size: 401 Bytes
Contents
class Text def self.replace_text_in_glob(glob,search,replace) Dir.glob(glob).each{ |f| replace_text_in_file(f,search,replace) } end def self.replace_text_in_file(filename,search,replace) text1 = File.read(filename) text2 = text1.gsub(search) { |str| str=replace } unless text1==text2 File.open(filename,"w") { |f| f.puts text2 } end end end
Version data entries
106 entries across 106 versions & 1 rubygems