Skip to content
Snippets Groups Projects
Commit 341b64cc authored by Mike McQuaid's avatar Mike McQuaid
Browse files

Formula-Cookbook: better `inreplace` example.

Make multiple replacements if using the block form.
parent 26118d62
No related branches found
No related tags found
No related merge requests found
...@@ -373,11 +373,12 @@ A convenience function that can edit files in-place. For example: ...@@ -373,11 +373,12 @@ A convenience function that can edit files in-place. For example:
`inreplace "path", before, after` `inreplace "path", before, after`
`before` and `after` can be strings or regular expressions. You can also use the block form: `before` and `after` can be strings or regular expressions. You should use the block form if you need to make multiple replacements in a file:
```ruby ```ruby
inreplace "path" do |s| inreplace "path" do |s|
s.gsub! /foo/, "bar" s.gsub! /foo/, "bar"
s.gsub! "123", "456"
end end
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment