Sha256: 61a2ed4be6237e8a0f98aea5d47de5bc45c0e83b375db3d57a6e8a06e94b7cb4
Contents?: true
Size: 456 Bytes
Versions: 1
Compression:
Stored size: 456 Bytes
Contents
require 'yaml' module Codebreaker module Data def save File.open('/app/lib/data.yaml', 'a') do |file| YAML.dump({ player: @player, hints_left: @hints_left, \ attempts: @attempts, score: score }, file) end end def load file = File.open('/app/lib/data.yaml') games = [] file.nil? ? "No #{file} file found." : YAML.load_stream(file) { |doc| games << doc } games end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
codebreaker_web-0.1.4 | lib/codebreaker/data.rb |