Module: What::Modules

Defined in:
lib/what/modules.rb

Defined Under Namespace

Classes: Base, Disk, Existence, Http, Memory, Process, Unicorn, What

Class Method Summary collapse

Class Method Details

.config_module_full_pathsObject



12
13
14
15
16
17
18
# File 'lib/what/modules.rb', line 12

def self.config_module_full_paths
  paths = Config["module_paths"] || []

  paths.map do |path|
    path.include?("/") ? path : File.join(Config["base"], path)
  end
end

.load_allObject

Load all modules from any paths specified in the config file.



6
7
8
9
10
# File 'lib/what/modules.rb', line 6

def self.load_all
  config_module_full_paths.each do |path|
    require_dir(path)
  end
end

.require_dir(path) ⇒ Object



20
21
22
23
24
# File 'lib/what/modules.rb', line 20

def self.require_dir(path)
  Dir[File.join(path, '*.rb')].each do |fn|
    require fn
  end
end