Class: LoadPath::LoadPathSetup

Inherits:
PathHelper show all
Defined in:
lib/load_path.rb

Overview

Helper class to setup the load path

Instance Attribute Summary

Attributes inherited from PathHelper

#root_dir

Instance Method Summary collapse

Methods inherited from PathHelper

#child_directory, #file_path, #initialize, #parent_directory, #sibling_directory

Constructor Details

This class inherits a constructor from LoadPath::PathHelper

Instance Method Details

#add(directory) ⇒ Object

Add the given directory to the load path



47
48
49
# File 'lib/load_path.rb', line 47

def add(directory)
  $: << directory
end

#path_builder(&block) ⇒ Object



51
52
53
54
55
# File 'lib/load_path.rb', line 51

def path_builder(&block)
  builder = LoadPath::PathBuilder.new(self.file_path)
  builder.instance_eval(&block)
  builder.file_path
end

#require_files(directory, file_pattern = '*.rb') ⇒ Object

Require all files matching the pattern in the directory



40
41
42
43
44
# File 'lib/load_path.rb', line 40

def require_files(directory, file_pattern='*.rb')
  Dir.glob(File.join(directory, file_pattern)) do |file|
    require File.basename(file.to_s)
  end
end