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

Version Path
dev_tasks-0.0.140 lib/text.rb
dev_tasks-0.0.139 lib/text.rb
dev_tasks-0.0.138 lib/text.rb
dev_tasks-0.0.137 lib/text.rb
dev_tasks-0.0.136 lib/text.rb
dev_tasks-0.0.135 lib/text.rb
dev_tasks-0.0.134 lib/text.rb
dev_tasks-0.0.133 lib/text.rb
dev_tasks-0.0.132 lib/text.rb
dev_tasks-0.0.131 lib/text.rb
dev_tasks-0.0.130 lib/text.rb
dev_tasks-0.0.129 lib/text.rb
dev_tasks-0.0.128 lib/text.rb
dev_tasks-0.0.127 lib/text.rb
dev_tasks-0.0.126 lib/text.rb
dev_tasks-0.0.125 lib/text.rb
dev_tasks-0.0.124 lib/text.rb
dev_tasks-0.0.123 lib/text.rb
dev_tasks-0.0.122 lib/text.rb
dev_tasks-0.0.121 lib/text.rb