Module: CodebreakerApi
- Included in:
- CodeBreaker
- Defined in:
- lib/codebreaker/codebreaker_api.rb
Constant Summary collapse
- PATH =
'./stats.yml'.freeze
Instance Method Summary collapse
Instance Method Details
#load(path = PATH) ⇒ Object
4 5 6 |
# File 'lib/codebreaker/codebreaker_api.rb', line 4 def load(path = PATH) File.exist?(path) && Psych.load(File.read(path)) end |
#save(data, path = PATH) ⇒ Object
8 9 10 11 12 |
# File 'lib/codebreaker/codebreaker_api.rb', line 8 def save(data, path = PATH) File.open(path, 'w') do |file| file.write(Psych.dump(data)) unless data.nil? end end |