class ReplaceDocument
Attributes
original_file[RW]
temp_file[RW]
Public Class Methods
new(original_file, temp_file)
click to toggle source
# File lib/replace_it.rb, line 6 def initialize(original_file, temp_file) @original_file = original_file @temp_file = temp_file end
Public Instance Methods
document_replace(string, new_string)
click to toggle source
# File lib/replace_it.rb, line 11 def document_replace(string, new_string) File.open(@temp_file, 'w') do |file| file.puts File.read(@original_file).gsub(/#{string}/, new_string) end end