Sha256: 40c7591cff9fc95bb52372bd157450dade2d2e6b8d79775ee3c62c615c0c40a2

Contents?: true

Size: 502 Bytes

Versions: 8

Compression:

Stored size: 502 Bytes

Contents

module Verdict
  module Storage
    class MemoryStorage < BaseStorage
      attr_reader :storage

      def initialize
        @storage = {}
      end

      protected

      def get(scope, key)
        @storage[scope] ||= {}
        @storage[scope][key]
      end

      def set(scope, key, value)
        @storage[scope] ||= {}
        @storage[scope][key] = value
      end

      def remove(scope, key)
        @storage[scope] ||= {}
        @storage[scope].delete(key)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
verdict-0.16.1 lib/verdict/storage/memory_storage.rb
verdict-0.16.0 lib/verdict/storage/memory_storage.rb
verdict-0.15.2 lib/verdict/storage/memory_storage.rb
verdict-0.15.1 lib/verdict/storage/memory_storage.rb
verdict-0.15.0 lib/verdict/storage/memory_storage.rb
verdict-0.14.0 lib/verdict/storage/memory_storage.rb
verdict-0.13.0 lib/verdict/storage/memory_storage.rb
verdict-0.12.0 lib/verdict/storage/memory_storage.rb