Module: Kernel
- Defined in:
- lib/slick/monkey_patches/require_all.rb
Instance Method Summary collapse
Instance Method Details
#require_all(path) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/slick/monkey_patches/require_all.rb', line 4 def require_all(path) $LOAD_PATH.each do |current_load_path| candidate_path = "#{current_load_path}/#{path}" require path if File.exist?("#{candidate_path}.rb") || File.exist?("#{candidate_path}.ruby") if Dir.exist?(candidate_path) Dir.open(candidate_path).sort.each do |item| item = item.sub(/(\.[^\.]+)$/, '') require_all("#{path}/#{item}") if item != '..' && item != '.' end end end end |