Module: Kernel
- Defined in:
- lib/boots.rb
Instance Method Summary collapse
- #boot(relpath) ⇒ Object (also: #requires)
- #directory_of_caller(_caller) ⇒ Object
- #load_paths(*paths) ⇒ Object (also: #load_path)
Instance Method Details
#boot(relpath) ⇒ Object Also known as: requires
4 5 6 |
# File 'lib/boots.rb', line 4 def boot relpath require File. File.join(directory_of_caller(caller), relpath) end |
#directory_of_caller(_caller) ⇒ Object
17 18 19 20 21 |
# File 'lib/boots.rb', line 17 def directory_of_caller(_caller) fn = File.dirname _caller[0].split(/:in/)[0] fn = File.(fn) unless fn.include?(FileUtils.pwd) fn end |
#load_paths(*paths) ⇒ Object Also known as: load_path
9 10 11 12 13 14 |
# File 'lib/boots.rb', line 9 def load_paths *paths dir = directory_of_caller(caller) # has to be outside the .each paths.flatten.each do |relpath| $:.unshift File.join(dir, relpath) end end |