Module: CodebreakerApi
- Included in:
- CodeBreaker
- Defined in:
- lib/codebreaker/codebreaker_api.rb
Constant Summary collapse
- PATH =
'./lib/codebreaker/stats.yml'.freeze
Instance Method Summary collapse
Instance Method Details
#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 |
#stats_base(path = PATH) ⇒ Object
4 5 6 |
# File 'lib/codebreaker/codebreaker_api.rb', line 4 def stats_base(path = PATH) File.exist?(path) && Psych.load(File.read(path)) end |