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.120 lib/text.rb
dev_tasks-0.0.119 lib/text.rb
dev_tasks-0.0.118 lib/text.rb
dev_tasks-0.0.117 lib/text.rb
dev_tasks-0.0.116 lib/text.rb
dev_tasks-0.0.115 lib/text.rb
dev_tasks-0.0.114 lib/text.rb
dev_tasks-0.0.113 lib/text.rb
dev_tasks-0.0.112 lib/text.rb
dev_tasks-0.0.111 lib/text.rb
dev_tasks-0.0.110 lib/text.rb
dev_tasks-0.0.109 lib/text.rb
dev_tasks-0.0.108 lib/text.rb
dev_tasks-0.0.107 lib/text.rb
dev_tasks-0.0.106 lib/text.rb
dev_tasks-0.0.105 lib/text.rb
dev_tasks-0.0.104 lib/text.rb
dev_tasks-0.0.103 lib/text.rb
dev_tasks-0.0.102 lib/text.rb
dev_tasks-0.0.101 lib/text.rb