Sha256: 229f5419cb39c700043dbb001bdbe50dbaca223e4976c27dacd48f6df76135ff
Contents?: true
Size: 748 Bytes
Versions: 1
Compression:
Stored size: 748 Bytes
Contents
module LogCabin ## # Define a collection of modules in a local dir class DirCollection < BaseCollection attr_reader :load_path def initialize(params = {}) @load_path = params[:load_path] || raise('Load path must be provided') @load_path = [@load_path] if @load_path.is_a? String super end ## # Method for finding modules to load def find(name) cache(name) { load_class_from_module(find_file(name), name) } end private ## # Check module path for module def find_file(name) @load_path.each do |dir| file_path = File.join(dir, "#{name}.rb") return file_path if File.exist? file_path end raise("Module #{name} not found") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logcabin-0.1.3 | lib/logcabin/dircollection.rb |