Module: DbUtils

Defined in:
lib/utils/db_utils.rb

Class Method Summary collapse

Class Method Details

.add(path, element) ⇒ Object



3
4
5
6
7
# File 'lib/utils/db_utils.rb', line 3

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

.get(path) ⇒ Object



9
10
11
12
# File 'lib/utils/db_utils.rb', line 9

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