Class: DevSuite::Utils::FileWriter::WriterManager

Inherits:
Object
  • Object
show all
Defined in:
lib/dev_suite/utils/file_writer/writer_manager.rb

Constant Summary collapse

WRITERS =
{
  ".json" => Writer::Json,
  ".yml" => Writer::Yaml,
  ".yaml" => Writer::Yaml,
  ".txt" => Writer::Text,
}.freeze

Class Method Summary collapse

Class Method Details

.append(path, content) ⇒ Object



21
22
23
# File 'lib/dev_suite/utils/file_writer/writer_manager.rb', line 21

def append(path, content)
  writer_instance(path).append(content)
end

.delete_key(path, key) ⇒ Object



33
34
35
# File 'lib/dev_suite/utils/file_writer/writer_manager.rb', line 33

def delete_key(path, key)
  writer_instance(path).delete_key(key)
end

.delete_lines(path, start_line, end_line = start_line) ⇒ Object



25
26
27
# File 'lib/dev_suite/utils/file_writer/writer_manager.rb', line 25

def delete_lines(path, start_line, end_line = start_line)
  writer_instance(path).delete_lines(start_line, end_line)
end

.update_key(path, key, value) ⇒ Object



29
30
31
# File 'lib/dev_suite/utils/file_writer/writer_manager.rb', line 29

def update_key(path, key, value)
  writer_instance(path).update_key(key, value)
end

.write(path, content) ⇒ Object



17
18
19
# File 'lib/dev_suite/utils/file_writer/writer_manager.rb', line 17

def write(path, content)
  writer_instance(path).write(content)
end