mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Added documentation to gsub_file method
This commit is contained in:
committed by
Matt Jones
parent
1ea13fce1a
commit
297276b99c
@@ -359,6 +359,12 @@ module Rails
|
||||
!yes?(question)
|
||||
end
|
||||
|
||||
# Run a regular expression replacement on a file
|
||||
#
|
||||
# ==== Example
|
||||
#
|
||||
# gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1'
|
||||
#
|
||||
def gsub_file(relative_destination, regexp, *args, &block)
|
||||
path = destination_path(relative_destination)
|
||||
content = File.read(path).gsub(regexp, *args, &block)
|
||||
@@ -369,4 +375,4 @@ module Rails
|
||||
File.join(root, relative_destination)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user