diff options
author | Andrew Timberlake <andrew@andrewtimberlake.com> | 2008-12-27 18:29:40 +0200 |
---|---|---|
committer | Matt Jones <al2o3cr@gmail.com> | 2008-12-28 01:25:23 -0500 |
commit | 297276b99c2d14bcce2fd19f9ab3de75ea3dbc68 (patch) | |
tree | aec23354989af5c0086ab286ced4c18a283c8309 /railties/lib/rails_generator | |
parent | 1ea13fce1aa8dfa75c45b9dbe352eeb76f36a48f (diff) | |
download | rails-297276b99c2d14bcce2fd19f9ab3de75ea3dbc68.tar.gz rails-297276b99c2d14bcce2fd19f9ab3de75ea3dbc68.tar.bz2 rails-297276b99c2d14bcce2fd19f9ab3de75ea3dbc68.zip |
Added documentation to gsub_file method
Diffstat (limited to 'railties/lib/rails_generator')
-rw-r--r-- | railties/lib/rails_generator/generators/applications/app/template_runner.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/railties/lib/rails_generator/generators/applications/app/template_runner.rb b/railties/lib/rails_generator/generators/applications/app/template_runner.rb index c6113648e6..1e0c6cc3ff 100644 --- a/railties/lib/rails_generator/generators/applications/app/template_runner.rb +++ b/railties/lib/rails_generator/generators/applications/app/template_runner.rb @@ -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
\ No newline at end of file +end |