Sha256: 975bd57891219cd3433a4bbd522a9377c43335797d8c6b8b98d13c5c20a2f906

Contents?: true

Size: 485 Bytes

Versions: 2

Compression:

Stored size: 485 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.id] = record
      end

      def find(id)
        @items[id]
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
key-vortex-0.1.4 lib/key_vortex/adapter/memory.rb
key-vortex-0.1.3 lib/key_vortex/adapter/memory.rb