Skip to content

Instantly share code, notes, and snippets.

@banister
Forked from chewmanfoo/simplifiable.rb
Created January 8, 2013 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banister/4485812 to your computer and use it in GitHub Desktop.
Save banister/4485812 to your computer and use it in GitHub Desktop.
def replace_line_in_file(old,new,file)
@fst = File.read(file)
@fst.gsub!(old,new)
File.open(file,"w") {|f| f.puts @fst}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment