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-1.0.34 lib/text.rb
dev_tasks-1.0.33 lib/text.rb
dev_tasks-1.0.31 lib/text.rb
dev_tasks-1.0.30 lib/text.rb
dev_tasks-1.0.29 lib/text.rb
dev_tasks-1.0.28 lib/text.rb
dev_tasks-1.0.27 lib/text.rb
dev_tasks-1.0.26 lib/text.rb
dev_tasks-1.0.25 lib/text.rb
dev_tasks-1.0.24 lib/text.rb
dev_tasks-1.0.23 lib/text.rb
dev_tasks-1.0.22 lib/text.rb
dev_tasks-1.0.21 lib/text.rb
dev_tasks-1.0.20 lib/text.rb
dev_tasks-1.0.19 lib/text.rb
dev_tasks-1.0.18 lib/text.rb
dev_tasks-1.0.17 lib/text.rb
dev_tasks-1.0.16 lib/text.rb
dev_tasks-1.0.15 lib/text.rb
dev_tasks-1.0.14 lib/text.rb