Sha256: 081e10f06c0a8bb1689198231e703a5e95b5e64e5865eb48f72659dfc060833f

Contents?: true

Size: 399 Bytes

Versions: 2

Compression:

Stored size: 399 Bytes

Contents

# frozen_string_literal: true

module Codebreaker
  module Uploader
    PATH_FOLDER = './data_base/'
    PATH_NAME = 'database'
    PATH_FORMAT = '.yaml'
    PATH = PATH_FOLDER + PATH_NAME + PATH_FORMAT

    def load_db
      File.exist?(PATH) ? YAML.load_stream(File.open(PATH)) : []
    end

    def save_to_db(results)
      File.open(PATH, 'a') { |f| f.write results.to_yaml }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
codebreaker_Shkidchenko-1.3.0 lib/app/modules/uploader/uploader.rb
codebreaker_Shkidchenko-0.2.0 lib/app/modules/uploader/uploader.rb