Class: PromptCanary::StorageFactory
- Inherits:
-
Object
- Object
- PromptCanary::StorageFactory
- Defined in:
- lib/prompt_canary/storage_factory.rb
Constant Summary collapse
- REGISTRY =
{ memory: -> { Storage::Memory.new }, sqlite: lambda { require "prompt_canary/storage/sqlite" Storage::SQLite.new }, active_record: lambda { require "prompt_canary/storage/active_record_adapter" Storage::ActiveRecord.new } }.freeze
Class Method Summary collapse
Class Method Details
.build(storage_name) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/prompt_canary/storage_factory.rb', line 17 def self.build(storage_name) builder = REGISTRY[storage_name] raise ConfigurationError, "Unknown storage: #{storage_name.inspect}" unless builder builder.call end |