Module: Hemi::Loader

Defined in:
lib/hemi/loader.rb

Class Method Summary collapse

Class Method Details

.load_tree(tree_dir, relative: false) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/hemi/loader.rb', line 3

def self.load_tree(tree_dir, relative: false)
  if File.exist?(manifest_file = File.join(__dir__, tree_dir, "_manifest.rb"))
    relative ? require_relative(manifest_file) : require(manifest_file)
  else
    Dir[File.join(__dir__, tree_dir, "**", "*.rb")].sort.each do |file|
      relative ? require_relative(file) : require(file)
    end
  end
end