Module: Karafka::Loader

Defined in:
lib/karafka/loader.rb

Overview

Loader for requiring all the files in a proper order

Constant Summary collapse

DIRS =

Order in which we want to load app files

%w[
  lib
  app
].freeze

Class Method Summary collapse

Class Method Details

.load(root) ⇒ Object

Will load files in a proper order (based on DIRS)

Parameters:

  • root (String)

    path from which we want to start



14
15
16
17
18
19
20
# File 'lib/karafka/loader.rb', line 14

def self.load(root)
  DIRS.each do |dir|
    path = File.join(root, dir)
    next unless File.exist?(path)
    load!(path)
  end
end

.load!(path) ⇒ Object

Requires all the ruby files from one path in a proper order

Parameters:

  • path (String)

    path (dir) from which we want to load ruby files in a proper order



24
25
26
# File 'lib/karafka/loader.rb', line 24

def self.load!(path)
  require_all(path)
end