Sha256: 91026e7beb5a6ae1822f867c336b20cc73e790a75374b300e3b297c81abfe1b1

Contents?: true

Size: 398 Bytes

Versions: 3

Compression:

Stored size: 398 Bytes

Contents

module RevealCK
  class FileStringReplacer

    def self.replace!(path, args)
      old, new = args[:old], args[:new]
      file = if File.exists? path
               path
             else
               File.expand_path(File.join(Dir.pwd, path))
             end
      lines = File.open(file).read
      lines = lines.sub old, new
      File.open(file, 'w') { |f| f << lines }
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reveal-ck-0.1.5 lib/reveal-ck/file_string_replacer.rb
reveal-ck-0.1.4 lib/reveal-ck/file_string_replacer.rb
reveal-ck-0.1.3 lib/reveal-ck/file_string_replacer.rb