class MetricFu::Loader

Attributes

loaded_files[R]

TODO: This class mostly serves to clean up the base MetricFu module,

but needs further work

Public Class Methods

new(lib_root) click to toggle source
# File lib/metric_fu/loader.rb, line 7
def initialize(lib_root)
  @lib_root = lib_root
  @loaded_files = []
end

Public Instance Methods

lib_require(base = "") { |paths, base_path)).each do |path| file = join(base_path, *Array(path))| ... } click to toggle source
# File lib/metric_fu/loader.rb, line 12
def lib_require(base = "", &_block)
  paths = []
  base_path = File.join(@lib_root, base)
  Array((yield paths, base_path)).each do |path|
    file = File.join(base_path, *Array(path))
    require file
    if @loaded_files.include?(file)
      puts "!!!\tAlready loaded #{file}" if !!(ENV["MF_DEBUG"] =~ /true/i)
    else
      @loaded_files << file
    end
  end