Sha256: 286b02bb76a0d62770a3d88f5a589a5375a1cdf718527ae52fd53bde7e2814ce

Contents?: true

Size: 452 Bytes

Versions: 119

Compression:

Stored size: 452 Bytes

Contents

puts __FILE__ if defined?(DEBUG)

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

119 entries across 119 versions & 1 rubygems

Version Path
dev-2.0.269 lib/base/text.rb
dev-2.0.268 lib/base/text.rb
dev-2.0.267 lib/base/text.rb
dev-2.0.266 lib/base/text.rb
dev-2.0.265 lib/base/text.rb
dev-2.0.264 lib/base/text.rb
dev-2.0.263 lib/base/text.rb
dev-2.0.262 lib/base/text.rb
dev-2.0.261 lib/base/text.rb
dev-2.0.260 lib/base/text.rb
dev-2.0.259 lib/base/text.rb
dev-2.0.258 lib/base/text.rb
dev-2.0.257 lib/base/text.rb
dev-2.0.256 lib/base/text.rb
dev-2.0.255 lib/base/text.rb
dev-2.0.254 lib/base/text.rb
dev-2.0.253 lib/base/text.rb
dev-2.0.252 lib/base/text.rb
dev-2.0.251 lib/base/text.rb
dev-2.0.250 lib/base/text.rb