Sha256: d475065a1dd123df7564a68dcce2b1d5ed2989211d0c1d52966a9ca74680360d
Contents?: true
Size: 532 Bytes
Versions: 2
Compression:
Stored size: 532 Bytes
Contents
module GemCodebreakerAmidasd require 'yaml' class DbUtility PATH_CODEBREAKER_DB = './db/codebreaker_db.yml'.freeze class << self def save_yaml_db(array, yml_db = PATH_CODEBREAKER_DB) File.write(yml_db, array.to_yaml) end def load_yaml_db(yml_db = PATH_CODEBREAKER_DB) return YAML.load_file(yml_db) if File.exist?(yml_db); [] end def add_in_db(array:, user:, game:) stats = Statistic.new(user: user, game: game) array << stats end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gem_codebreaker_amidasd-0.2.0 | lib/gem_codebreaker_amidasd/db_utility.rb |
gem_codebreaker_amidasd-0.1.9 | lib/gem_codebreaker_amidasd/db_utility.rb |