Sha256: c5cdd71c2d07cf5bc1a2e7d83356e0d09790f514fa49e874c30845df05931ada
Contents?: true
Size: 309 Bytes
Versions: 1
Compression:
Stored size: 309 Bytes
Contents
module Incr module Service class FileHelper def self.replace(filename, pattern, replacement_text) old_content = File.read(filename) new_content = old_content.sub(pattern, replacement_text) File.open(filename, 'w') { |file| file << new_content } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
incr-1.0.0 | lib/incr/service/file_helper.rb |