Module: Codebreaker::Database
- Included in:
- Console, Statistics
- Defined in:
- lib/modules/uploader.rb
Constant Summary collapse
- FOLDER_PATH =
'./lib/database/'.freeze
- FILE_PATH =
'stats'.freeze
- FORMAT_PATH =
'.yml'.freeze
- PATH =
FOLDER_PATH + FILE_PATH + FORMAT_PATH
Instance Method Summary collapse
Instance Method Details
#load_db ⇒ Object
12 13 14 |
# File 'lib/modules/uploader.rb', line 12 def load_db YAML.load_stream(File.open(PATH)) end |
#save_to_db(player) ⇒ Object
8 9 10 |
# File 'lib/modules/uploader.rb', line 8 def save_to_db(player) File.open(PATH, 'a+') { |f| f.write player.to_yaml } end |