Module: CodebreakerAp::Storage
- Included in:
- Game
- Defined in:
- lib/codebreaker_ap/modules/storage.rb
Instance Method Summary collapse
Instance Method Details
#read_from_file(file_name) ⇒ Object
9 10 11 |
# File 'lib/codebreaker_ap/modules/storage.rb', line 9 def read_from_file(file_name) YAML.load_file(file_name) if File.exist? file_name end |
#save_to_file(data, file_name) ⇒ Object
3 4 5 6 7 |
# File 'lib/codebreaker_ap/modules/storage.rb', line 3 def save_to_file(data, file_name) File.open(file_name, 'a+') do |this_file| this_file.write(YAML.dump(data)) end end |