lib/key_vortex/adapter/memory.rb in key-vortex-0.2.2 vs lib/key_vortex/adapter/memory.rb in key-vortex-0.2.3
- old
+ new
@@ -1,12 +1,17 @@
# frozen_string_literal: true
+require "key_vortex"
require "key_vortex/adapter"
class KeyVortex
class Adapter
class Memory < KeyVortex::Adapter
+ def self.build(items: {}, limitations: [])
+ new(items, limitations: limitations)
+ end
+
def initialize(items, limitations: [])
super()
@items = items
limitations.each { |limit| register_limitation(limit) }
end
@@ -23,5 +28,7 @@
@items.delete(key)
end
end
end
end
+
+KeyVortex.register(KeyVortex::Adapter::Memory)