Sha256: 50e5bbd0f60f0b26e66c650b2cbb0a51d9505904c42c1f1699d03215aa650469

Contents?: true

Size: 242 Bytes

Versions: 4

Compression:

Stored size: 242 Bytes

Contents

require 'yaml'
module DbUtils
  def self.add(path, element)
    File.open(path, 'w') do |file|
      file.write(element.to_yaml)
    end
  end

  def self.get(path)
    add(path, []) unless File.file?(path)
    YAML.load_file(path)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
codebreaker_paratskiy-0.2.4 lib/utils/db_utils.rb
codebreaker_paratskiy-0.2.3 lib/utils/db_utils.rb
codebreaker_paratskiy-0.2.2 lib/utils/db_utils.rb
codebreaker_paratskiy-0.2.1 lib/utils/db_utils.rb