Sha256: fb8a4c1a74423b5dcc6a495fd13ca538996fe921057f7f43bb599bd0bb8c238a

Contents?: true

Size: 375 Bytes

Versions: 3

Compression:

Stored size: 375 Bytes

Contents

module Codebreaker
  module Database
    FOLDER_PATH = './lib/database/'.freeze
    FILE_PATH = 'stats'.freeze
    FORMAT_PATH = '.yml'.freeze
    PATH = FOLDER_PATH + FILE_PATH + FORMAT_PATH

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

    private

    def load_db
      YAML.load_stream(File.open(PATH))
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
codebreaker_PI-0.6.1 lib/modules/uploader.rb
codebreaker_PI-0.6.0 lib/modules/uploader.rb
codebreaker_PI-0.0.1 lib/modules/uploader.rb