Sha256: b27c23f805008bf7ccf3c04238d7884f24ab95b18e130e126a7d71d7e10f7cc9

Contents?: true

Size: 280 Bytes

Versions: 1

Compression:

Stored size: 280 Bytes

Contents

module Codebreaker
  class FileStorage
    def initialize(path)
      @path = path
    end

    def load
      File.file?(@path) ? YAML.load_file(@path) : nil
    end

    def save(data)
      Pathname(@path).dirname.mkpath
      File.write(@path, data.to_yaml)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cb-core-0.1.6 lib/codebreaker/file_storage.rb