Sha256: 3e1a2cebef0e362043afc6d93d780a52c25d918eb0283996d87f2e3bddcaa161

Contents?: true

Size: 486 Bytes

Versions: 3

Compression:

Stored size: 486 Bytes

Contents

# frozen_string_literal: true

require "key_vortex/adapter"

class KeyVortex
  class Adapter
    class Memory < KeyVortex::Adapter
      def initialize(items, limitations: [])
        super()
        @items = items
        limitations.each { |limit| register_limitation(limit) }
      end

      def save(record)
        @items[record.key] = record
      end

      def find(id)
        @items[id]
      end

      def remove(key)
        @items.delete(key)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
key-vortex-0.2.2 lib/key_vortex/adapter/memory.rb
key-vortex-0.2.1 lib/key_vortex/adapter/memory.rb
key-vortex-0.2.0 lib/key_vortex/adapter/memory.rb