Sha256: 7582f5ef002a0d404988a2b9d07d8d3274ec51d8dc0f34efde7f3e0615b2d3d6

Contents?: true

Size: 352 Bytes

Versions: 4

Compression:

Stored size: 352 Bytes

Contents

# frozen_string_literal: true

module DataHandler
  def self.load(file_path)
    if File.exist?(file_path)
      YAML.safe_load(File.read(file_path), [Symbol], [], true)
    else
      File.open(file_path, 'w+')
      false
    end
  end

  def self.save(file_path, object)
    File.open(file_path, 'w') { |file| file.write(object.to_yaml) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
codebreaker_gapdn-0.1.5 lib/database/data_handler.rb
codebreaker_gapdn-0.1.3 lib/database/data_handler.rb
codebreaker_gapdn-0.1.1 lib/database/data_handler.rb
codebreaker_gapdn-0.1.0 lib/database/data_handler.rb