Class: Klue::Langcraft::DSL::ProcessorConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/klue/langcraft/dsl/processor_config.rb

Overview

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.

Instance Method Summary collapse

Constructor Details

#initializeProcessorConfig

Returns a new instance of ProcessorConfig.



12
13
14
# File 'lib/klue/langcraft/dsl/processor_config.rb', line 12

def initialize
  @processors = {}
end

Instance Method Details

#all_processorsObject

List all registered processors



29
30
31
# File 'lib/klue/langcraft/dsl/processor_config.rb', line 29

def all_processors
  @processors
end

#processor_for(key) ⇒ Object

Find the processor class by key



24
25
26
# File 'lib/klue/langcraft/dsl/processor_config.rb', line 24

def processor_for(key)
  @processors[key.to_sym]
end

#register_processor(processor_class) ⇒ Object

Register a processor with its associated keys



17
18
19
20
21
# File 'lib/klue/langcraft/dsl/processor_config.rb', line 17

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