Method: Fast.replace_file
- Defined in:
- lib/fast/rewriter.rb
.replace_file(pattern, file, &replacement) ⇒ Object
Replaces the source of an ast_from_file with and the same source if the pattern does not match.
33 34 35 36 |
# File 'lib/fast/rewriter.rb', line 33 def replace_file(pattern, file, &replacement) ast = ast_from_file(file) replace(pattern, ast, IO.read(file), &replacement) end |