Sha256: ac14abeeb54110ccd7f717614beee63dcc83d5fbb352bd7c42d711daafdde94e

Contents?: true

Size: 271 Bytes

Versions: 6

Compression:

Stored size: 271 Bytes

Contents

require 'yaml'

module Chicanery
  module Persistence
    def persist state
      File.open 'state', 'w' do |file|
        file.puts state.to_yaml
      end
    end

    def restore
      return {} unless File.exist? 'state'
      YAML.load_file 'state'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chicanery-0.0.7 lib/chicanery/persistence.rb
chicanery-0.0.6 lib/chicanery/persistence.rb
chicanery-0.0.5 lib/chicanery/persistence.rb
chicanery-0.0.4 lib/chicanery/persistence.rb
chicanery-0.0.3 lib/chicanery/persistence.rb
chicanery-0.0.2 lib/chicanery/persistence.rb