Sha256: 161c1c5a46da50b43a462565044f66196c586786aeafae702e65ad67c5d7b4b8
Contents?: true
Size: 378 Bytes
Versions: 7
Compression:
Stored size: 378 Bytes
Contents
class Text def self.replace_in_glob(glob,search,replace) Dir.glob(glob).each{ |f| replace_text_in_file(f,search,replace) } end def self.replace_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
7 entries across 7 versions & 1 rubygems