Class: AndriiCodebreaker::DbYaml

Inherits:
Object
  • Object
show all
Defined in:
lib/andrii_codebreaker/model.rb

Class Method Summary collapse

Class Method Details

.load_file(path) ⇒ Object



6
7
8
9
10
# File 'lib/andrii_codebreaker/model.rb', line 6

def load_file(path)
  File.open(path, 'r') do |filename|
    YAML.safe_load(filename)
  end
end

.load_file_stats(path) ⇒ Object



16
17
18
# File 'lib/andrii_codebreaker/model.rb', line 16

def load_file_stats(path)
  YAML.load_stream(File.open(path))
end

.save(user, path) ⇒ Object



12
13
14
# File 'lib/andrii_codebreaker/model.rb', line 12

def save(user, path)
  File.open(path, 'a') { |f| YAML.dump(user, f) }
end