Class: QueryGuard::Uploader::Registry
- Inherits:
-
Object
- Object
- QueryGuard::Uploader::Registry
- Defined in:
- lib/query_guard/uploader/registry.rb
Overview
Registry for selecting and instantiating uploaders.
Provides a factory pattern for creating the appropriate uploader based on configuration.
Class Method Summary collapse
-
.available_uploaders ⇒ Object
List all available uploader types.
-
.for_config(config) ⇒ Interface
Get the appropriate uploader for the given configuration.
Class Method Details
.available_uploaders ⇒ Object
List all available uploader types.
29 30 31 32 33 34 |
# File 'lib/query_guard/uploader/registry.rb', line 29 def self.available_uploaders { 'no-op' => 'Local/no-op mode (default, no upload)', 'http' => 'HTTP API upload (for future SaaS platform)' } end |
.for_config(config) ⇒ Interface
Get the appropriate uploader for the given configuration.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/query_guard/uploader/registry.rb', line 14 def self.for_config(config) uploader_type = config.uploader_type&.downcase || 'no-op' case uploader_type when 'http' HttpUploader.new(config) when 'no-op', 'noop', 'none', 'disabled', nil NoOpUploader.new(config) else raise ArgumentError, "Unknown uploader type: #{uploader_type}. " \ "Supported: 'http', 'no-op' (default)" end end |