Class: Karafka::Setup::Configurators::Params

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/setup/configurators/params.rb

Overview

Karafka::Params::Params are dynamically built based on user defined parent class so we cannot just require it, we need to initialize it after user is done with the framework configuration. This is a configurator that does exactly that.

Class Method Summary collapse

Class Method Details

.setup(config) ⇒ Object

Builds up Karafka::Params::Params class with user defined parent class

Parameters:



12
13
14
15
16
17
18
19
20
21
# File 'lib/karafka/setup/configurators/params.rb', line 12

def self.setup(config)
  return if defined? Karafka::Params::Params

  Karafka::Params.const_set(
    'Params',
    Class
      .new(config.params_base_class)
      .tap { |klass| klass.include(Karafka::Params::Dsl) }
  )
end