Module: DeepCover::Tools::RequireRelativeDir

Included in:
DeepCover
Defined in:
lib/deep_cover/tools/require_relative_dir.rb

Instance Method Summary collapse

Instance Method Details

#require_relative_dir(dir_name, except: []) ⇒ Object



5
6
7
8
9
10
# File 'lib/deep_cover/tools/require_relative_dir.rb', line 5

def require_relative_dir(dir_name, except: [])
  dir = File.dirname(caller(1..1).first.partition(/\.rb:\d/).first)
  Dir["#{dir}/#{dir_name}/*.rb"].sort.each do |file|
    require file unless except.include? File.basename(file, '.rb')
  end
end