Class: DevSuite::Utils::FileWriter::Writer::Yaml

Inherits:
Base show all
Defined in:
lib/dev_suite/utils/file_writer/writer/yaml.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, normalize: false, backup: false, yaml_options: {}) ⇒ Object



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

def write(content, normalize: false, backup: false, yaml_options: {})
  validate_content(content)
  create_backup(path) if backup

  yaml_content = prepare_yaml_content(content, normalize, yaml_options)
  AtomicWriter.new(path, yaml_content).write
end