Class: Karafka::Helpers::ConfigImporter
- Inherits:
 - 
      Module
      
        
- Object
 - Module
 - Karafka::Helpers::ConfigImporter
 
 
- Defined in:
 - lib/karafka/helpers/config_importer.rb
 
Overview
Module allowing for configuration injections. By default injects whole app config Allows for granular config injection
Instance Method Summary collapse
- #included(model) ⇒ Object
 - 
  
    
      #initialize(attributes = { config: %i[itself] })  ⇒ ConfigImporter 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ConfigImporter.
 
Constructor Details
#initialize(attributes = { config: %i[itself] }) ⇒ ConfigImporter
Returns a new instance of ConfigImporter.
      11 12 13 14  | 
    
      # File 'lib/karafka/helpers/config_importer.rb', line 11 def initialize(attributes = { config: %i[itself] }) super() @attributes = attributes end  | 
  
Instance Method Details
#included(model) ⇒ Object
      17 18 19 20 21 22 23 24 25 26 27  | 
    
      # File 'lib/karafka/helpers/config_importer.rb', line 17 def included(model) super @attributes.each do |name, path| model.class_eval <<~RUBY, __FILE__, __LINE__ + 1 def #{name} @#{name} ||= ::Karafka::App.config.#{path.join('.')} end RUBY end end  |