Sha256: 53000d4873dc11e24b9cfec24295635394555c94c1b6118c18c53f567268478c
Contents?: true
Size: 531 Bytes
Versions: 1
Compression:
Stored size: 531 Bytes
Contents
class Text def self.replace_in_glob(glob,search,replace) Dir.glob(glob).each{ |f| replace_in_file(f,search,replace) } end def self.replace_in_file(filename,search,replace) #text1 = IO.read(filename).force_encoding("ISO-8859-1").encode("utf-8", replace: nil) text1 = IO.read(filename)#.encode("utf-8", replace: nil) #File.read(f,:encoding=>'UTF-8') text2 = text1.gsub(search) { |str| str=replace } unless text1==text2 File.open(filename,"w") { |f| f.puts text2 } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dev_commands-0.0.56 | lib/text.rb |