Method: Chef::Util::FileEdit#initialize

Defined in:
lib/chef/util/file_edit.rb

#initialize(filepath) ⇒ FileEdit

Returns a new instance of FileEdit.

Raises:

  • (ArgumentError)


31
32
33
34
35
36
37
# File 'lib/chef/util/file_edit.rb', line 31

def initialize(filepath)
  raise ArgumentError, "File '#{filepath}' does not exist" unless TargetIO::File.exist?(filepath)

  @editor = Editor.new(TargetIO::File.open(filepath, &:readlines))
  @original_pathname = filepath
  @file_edited = false
end