Class: GemBootstrap::FileWriter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/gem-bootstrap/file_writer.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(io:) ⇒ FileWriter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FileWriter.



9
10
11
12
# File 'lib/gem-bootstrap/file_writer.rb', line 9

def initialize(io:)
  @conflicts = FileConflictManager.new(io: io)
  @io = io
end

Instance Method Details

#write(file_path, file_contents) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
17
18
19
20
# File 'lib/gem-bootstrap/file_writer.rb', line 14

def write(file_path, file_contents)
  if File.exist?(file_path)
    handle_file_exists(file_path, file_contents)
  else
    handle_new_file(file_path, file_contents)
  end
end