Skip to content

Commit 91d8d1e

Browse files
author
Nuo Yan
committed
initial work (updated) chef-78
1 parent 2cfd959 commit 91d8d1e

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

chef/lib/chef/util/FileEdit.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ def initialize(filepath)
1313
@match = false
1414

1515

16-
raise ArgumentError, "File doesn't exist" unless (ret = File.exist? @filename)
17-
18-
f = File.new(@filename)
19-
raise ArgumentError, "File is blank" unless (@contents = f.readlines).length > 0
16+
raise ArgumentError, "File doesn't exist" unless File.exist? @filename
17+
raise ArgumentError, "File is blank" unless (@contents = File.new(@filename).readlines).length > 0
2018

2119
end
2220

@@ -69,7 +67,7 @@ def write_file
6967

7068
private
7169

72-
#helper method to search_file_replace_delete_line, search_file_replace_delete, and insert_line_after_match
70+
#helper method to do the match, replace, delete, and insert operations
7371
#command is the switch of delete, replace, and insert ('d', 'r', 'i')
7472
#method is to control operation on whole line or only the match (1 for line, 2 for match)
7573
def search_match(regex, replace, command, method)

0 commit comments

Comments
 (0)