Sha256: bade5bcc72bcc38e10e296359c8cb9d8f34c55ecdb6830750113dd3e1d2d8099
Contents?: true
Size: 548 Bytes
Versions: 1
Compression:
Stored size: 548 Bytes
Contents
module GemCodebreakerAmidasd require 'yaml' class DbUtility class << self def save_yaml_db(user, yml_db) File.write(yml_db, user.to_yaml) end def load_yaml_db(yml_db) return unless File.exist?(yml_db) YAML.load_file(yml_db) end def add_db(user, path) db = load_yaml_db(path) db ||= [] db << user db = db.sort_by { |value| [value.total_count_attempt, value.count_attempt, value.count_hint] } save_yaml_db(db, path) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gem_codebreaker_amidasd-0.1.5 | lib/gem_codebreaker_amidasd/db_utility.rb |