lib/key_vortex.rb in key-vortex-0.2.2 vs lib/key_vortex.rb in key-vortex-0.2.3

- old
+ new

@@ -3,9 +3,23 @@ require_relative "key_vortex/version" class KeyVortex class Error < StandardError; end + def self.register(adapter_class) + @adapter_registry ||= {} + @adapter_registry[adapter_class.symbol] = adapter_class + end + + def self.vortex(adapter_symbol, record_class, **options) + new( + @adapter_registry[adapter_symbol].build(**options), + record_class + ) + end + + attr_reader :adapter, :record_class + def initialize(adapter, record_class) @adapter = adapter @record_class = record_class record_class.fields.each do |field|