Skip to content

Instantly share code, notes, and snippets.

@thisivan
Created May 19, 2009 13:13
Show Gist options
  • Save thisivan/114078 to your computer and use it in GitHub Desktop.
Save thisivan/114078 to your computer and use it in GitHub Desktop.
gsub file
def gsub_file(relative_destination, regexp, *args, &block)
path = destination_path(relative_destination)
content = File.read(path).gsub(regexp, *args, &block)
File.open(path, 'wb') { |file| file.write(content) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment