Sha256: 0630e9d2d05196ca7f6ef53a09db8d3b2ec3387bc5aba3ab091a44c12f98028d

Contents?: true

Size: 441 Bytes

Versions: 10

Compression:

Stored size: 441 Bytes

Contents

# frozen_string_literal: true

module CodebreakerRuban
  class Storage
    FILE_NAME = './lib/app/store/store.yml'
    class << self
      def save_in_store(obj)
        File.open(FILE_NAME, 'a') { |file| file.write obj.to_yaml }
      end

      def load_storage
        store_exists? ? YAML.load_stream(File.read(FILE_NAME)) : []
      end

      private

      def store_exists?
        File.exist?(FILE_NAME)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
codebreaker_ruban-0.3.8 lib/app/entities/storage.rb
codebreaker_ruban-0.3.7 lib/app/entities/storage.rb
codebreaker_ruban-0.3.6 lib/app/entities/storage.rb
codebreaker_ruban-0.3.5 lib/app/entities/storage.rb
codebreaker_ruban-0.3.4 lib/app/entities/storage.rb
codebreaker_ruban-0.3.2 lib/app/entities/storage.rb
codebreaker_ruban-0.3.1 lib/app/entities/storage.rb
codebreaker_ruban-0.3.0 lib/app/entities/storage.rb
codebreaker_ruban-0.2.0 lib/app/entities/storage.rb
codebreaker_ruban-0.1.0 lib/app/entities/storage.rb