Class: DevSuite::Utils::FileWriter::Writer::Json

Inherits:
Base show all
Defined in:
lib/dev_suite/utils/file_writer/writer/json.rb

Instance Attribute Summary

Attributes inherited from Base

#path

Instance Method Summary collapse

Methods inherited from Base

#append, #append_array, #delete_key, #delete_lines, #initialize, #read, #update_key

Methods inherited from Construct::Component::Base

component_key

Constructor Details

This class inherits a constructor from DevSuite::Utils::FileWriter::Writer::Base

Instance Method Details

#write(content, pretty: false, backup: false) ⇒ Object



8
9
10
11
12
13
# File 'lib/dev_suite/utils/file_writer/writer/json.rb', line 8

def write(content, pretty: false, backup: false)
  create_backup(path) if backup

  json_content = convert_to_json(content, pretty)
  AtomicWriter.new(path, json_content).write
end