Sha256: 626d86cbba389e1ef90197580e8d59eecaaf8eac77aff5b93948f9177167619f
Contents?: true
Size: 564 Bytes
Versions: 4
Compression:
Stored size: 564 Bytes
Contents
# frozen_string_literal: true module DevSuite module Utils module FileWriter module Writer class Json < Base def write(path, content, pretty: false, backup: false) create_backup(path) if backup json_content = convert_to_json(content, pretty) AtomicWriter.new(path, json_content).write end private def convert_to_json(content, pretty) pretty ? ::JSON.pretty_generate(content) : ::JSON.dump(content) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems