Class | Chef::Util::FileEdit
In: | lib/chef/util/file_edit.rb
Parent: | Object

### Methods

insert_line_after_match new search_file_delete search_file_delete_line search_file_replace search_file_replace_line write_file

### Attributes

contents | [RW] |
file_edited | [RW] |
original_pathname | [RW] |

### Public Class methods

new(filepath)

### Public Instance methods

insert_line_after_match(regex, newline)

search the file line by line and match each line with the given regex if matched, insert newline after each matching line

search_file_delete(regex)

search the file line by line and match each line with the given regex if matched, delete the match (all occurances) from the line

search_file_delete_line(regex)

search the file line by line and match each line with the given regex if matched, delete the line

search_file_replace(regex, replace)

search the file line by line and match each line with the given regex if matched, replace the match (all occurances) with the replace parameter

search_file_replace_line(regex, newline)

search the file line by line and match each line with the given regex if matched, replace the whole line with newline.

write_file()

Make a copy of old_file and write new file out (only if file changed)

[Validate]