Sha256: a1e57b62853351acf095b87af9cb3c32e1bf533a5fa9508c8f42d5a583aa7db7

Contents?: true

Size: 416 Bytes

Versions: 53

Compression:

Stored size: 416 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)
     text2 = text1.gsub(search) { |str| str=replace }
     unless text1==text2
       File.open(filename,"w") { |f| f.puts text2 }
       return true
     end
     false
   end

end

Version data entries

53 entries across 53 versions & 2 rubygems

Version Path
dev-2.0.128 lib/commands/text.rb
dev-2.0.127 lib/commands/text.rb
dev-2.0.126 lib/commands/text.rb
dev-2.0.124 lib/commands/text.rb
dev-2.0.123 lib/commands/text.rb
dev-2.0.122 lib/commands/text.rb
dev-2.0.121 lib/commands/text.rb
dev-2.0.119 lib/commands/text.rb
dev-2.0.118 lib/commands/text.rb
dev-2.0.117 lib/commands/text.rb
dev-2.0.116 lib/commands/text.rb
dev-2.0.115 lib/commands/text.rb
dev-2.0.114 lib/commands/text.rb
dev-2.0.113 lib/commands/text.rb
dev-2.0.112 lib/commands/text.rb
dev-2.0.111 lib/commands/text.rb
dev-2.0.110 lib/commands/text.rb
dev-2.0.109 lib/commands/text.rb
dev-2.0.108 lib/commands/text.rb
dev-2.0.107 lib/commands/text.rb