Sha256: 10aa7d03686ba0a0bae2e599e5f3a3c2c39974ebca799464d4e30a66f64a0cf5

Contents?: true

Size: 943 Bytes

Versions: 3

Compression:

Stored size: 943 Bytes

Contents

# frozen_string_literal: true

module Klue
  module Langcraft
    module DSL
      # ProcessorConfig class for managing processor configurations
      #
      # This class is responsible for registering processors and providing
      # methods to retrieve processors based on keys or to get all registered
      # processors.
      class ProcessorConfig
        def initialize
          @processors = {}
        end

        # Register a processor with its associated keys
        def register_processor(processor_class)
          keys = processor_class.keys
          keys = [keys] unless keys.is_a?(Array)
          keys.each { |key| @processors[key.to_sym] = processor_class }
        end

        # Find the processor class by key
        def processor_for(key)
          @processors[key.to_sym]
        end

        # List all registered processors
        def all_processors
          @processors
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
klue-langcraft-0.4.0 lib/klue/langcraft/dsl/processor_config.rb
klue-langcraft-0.3.0 lib/klue/langcraft/dsl/processor_config.rb
klue-langcraft-0.2.0 lib/klue/langcraft/dsl/processor_config.rb